[Mod] add CodeEditor function to main window
This commit is contained in:
parent
7d940f74f6
commit
99fbebbbdb
@ -8,7 +8,7 @@ class CodeEditor(QtWidgets.QMainWindow):
|
||||
""""""
|
||||
NEW_FILE_NAME = "Untitled"
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, main_engine=None, event_engine=None):
|
||||
""""""
|
||||
super().__init__()
|
||||
|
||||
@ -296,6 +296,13 @@ class CodeEditor(QtWidgets.QMainWindow):
|
||||
|
||||
event.accept()
|
||||
|
||||
def show(self):
|
||||
""""""
|
||||
if not self.tab.count():
|
||||
self.open_editor()
|
||||
|
||||
self.showMaximized()
|
||||
|
||||
def update_path_label(self):
|
||||
""""""
|
||||
editor = self.get_active_editor()
|
||||
@ -436,7 +443,6 @@ if __name__ == "__main__":
|
||||
app = create_qapp()
|
||||
|
||||
editor = CodeEditor()
|
||||
editor.open_editor()
|
||||
editor.showMaximized()
|
||||
editor.show()
|
||||
|
||||
app.exec_()
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
@ -24,6 +24,7 @@ from .widget import (
|
||||
AboutDialog,
|
||||
GlobalDialog
|
||||
)
|
||||
from .editor import CodeEditor
|
||||
from ..engine import MainEngine
|
||||
from ..utility import get_icon_path, TRADER_DIR
|
||||
|
||||
@ -138,6 +139,18 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
partial(self.open_widget, ContractManager, "contract")
|
||||
)
|
||||
|
||||
self.add_menu_action(
|
||||
help_menu,
|
||||
"代码编辑",
|
||||
"editor.ico",
|
||||
partial(self.open_widget, CodeEditor, "editor"),
|
||||
)
|
||||
self.add_toolbar_action(
|
||||
"代码编辑",
|
||||
"editor.ico",
|
||||
partial(self.open_widget, CodeEditor, "editor")
|
||||
)
|
||||
|
||||
self.add_menu_action(
|
||||
help_menu, "还原窗口", "restore.ico", self.restore_window_setting
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user