notepad.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:notepad 作者: lfsando 项目源码 文件源码
def __init__(self, window_width=1000, window_height=950):
        super().__init__()

        # Initialize Plain Text Widget

        self.text_widget = QtWidgets.QPlainTextEdit()

        # Default Mode to Insertion

        self.insert = True

        # EventFilter FocusOut

        self._filter = Filter()

        # Setup Shortcuts

        self.shift_tab = QtWidgets.QShortcut(QtGui.QKeySequence('Shift+Tab'), self)
        #self.shift_tab.activated.setFocus()

        # Default start up File

        self.file_name = 'Untitled.txt'
        self.file_path = ['/', '']
        self.file_type = self.file_name.split('.')[-1]
        self.syntax = highlighter.PythonHighlighter(self.text_widget.document())
        self.assign_syntax_def()

        # Initialize Menus

        self.menu_bar = self.menuBar()
        self.file_menu()
        self.edit_menu()
        self.format_menu()
        self.preferences_menu()
        self.finder_toolbar()

        # Set Default Pallete

        self.default_visual()

        # Initialize UI Related Properties

        self.notepad_ui()

        self.setCentralWidget(self.text_widget)
        self.setWindowIcon(QtGui.QIcon('assets/icons/notepad.png'))
        self.resize(window_width, window_height)

        # Center the main window to the screen
        self.center()
        self.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号