@@ -23,47 +23,6 @@ def __init__(self, path):
2323 self .window = Window (self )
2424 self .window .set_icon ("icons/icon.png" )
2525
26- self .window .toolbar .add_action ("New" , "File" , "Ctrl+N" , "Create a new project" , testing ("new" ))
27- self .window .toolbar .add_action ("Open" , "File" , "Ctrl+O" , "Open an existing project" , self .open )
28- self .window .toolbar .add_action ("Save" , "File" , "Ctrl+S" , "Save the current Scene" , self .save )
29- self .window .toolbar .add_action ("Save As" , "File" , "Ctrl+Shift+S" , "Save the current Scene as new file" , testing ("save as" ))
30- self .window .toolbar .add_action ("Save a Copy As" , "File" , "Ctrl+Alt+S" , "Save a copy of the current Scene" , testing ("save copy as" ))
31- self .window .toolbar .add_separator ("File" )
32- self .window .toolbar .add_action ("Close Scene" , "File" , "Ctrl+W" , "Closes the current Scene" , testing ("close" ))
33- self .window .toolbar .add_action ("Close All" , "File" , "Ctrl+Shift+W" , "Closes all opened Scene" , testing ("close all" ))
34- self .window .toolbar .add_separator ("File" )
35- self .window .toolbar .add_action ("Quit" , "File" , "Ctrl+Q" , "Close the Editor" , self .quit_wrapper )
36-
37- self .window .toolbar .add_action ("Undo" , "Edit" , "Ctrl+Z" , "Undo the last action" , testing ("undo" ))
38- self .window .toolbar .add_action ("Redo" , "Edit" , "Ctrl+Shift+Z" , "Redo the last action" , testing ("redo" ))
39- self .window .toolbar .add_separator ("Edit" )
40- self .window .toolbar .add_action ("Cut" , "Edit" , "Ctrl+X" , "Deletes item and adds to clipboard" , testing ("cut" ))
41- self .window .toolbar .add_action ("Copy" , "Edit" , "Ctrl+C" , "Adds item to clipboard" , testing ("copy" ))
42- self .window .toolbar .add_action ("Paste" , "Edit" , "Ctrl+V" , "Pastes item from clipboard" , testing ("paste" ))
43- self .window .toolbar .add_separator ("Edit" )
44- self .window .toolbar .add_action ("Rename" , "Edit" , "F2" , "Renames the selected item" , testing ("rename" ))
45- self .window .toolbar .add_action ("Duplicate" , "Edit" , "Ctrl+D" , "Duplicates the selected item(s)" , testing ("duplicate" ))
46- self .window .toolbar .add_action ("Delete" , "Edit" , "Delete" , "Deletes item" , testing ("delete" ))
47- self .window .toolbar .add_separator ("Edit" )
48- self .window .toolbar .add_action ("Select All" , "Edit" , "Ctrl+A" , "Selects all items in the current Scene" , testing ("select all" ))
49- self .window .toolbar .add_action ("Select None" , "Edit" , "Escape" , "Deselects all items" , self .window .select_none )
50-
51- self .window .toolbar .add_sub_action ("Folder" , "Assets" , "Create" , "" , "" , testing ("new folder" ))
52- self .window .toolbar .add_sub_action ("File" , "Assets" , "Create" , "" , "" , testing ("new file" ))
53- self .window .toolbar .add_sub_separator ("Assets" , "Create" )
54- self .window .toolbar .add_sub_action ("Script" , "Assets" , "Create" , "" , "" , testing ("new script" ))
55- self .window .toolbar .add_sub_separator ("Assets" , "Create" )
56- self .window .toolbar .add_sub_action ("Scene" , "Assets" , "Create" , "" , "" , testing ("new scene" ))
57- self .window .toolbar .add_sub_action ("Prefab" , "Assets" , "Create" , "" , "" , testing ("new prefab" ))
58- self .window .toolbar .add_sub_action ("Material" , "Assets" , "Create" , "" , "" , testing ("new mat" ))
59- self .window .toolbar .add_sub_separator ("Assets" , "Create" )
60- self .window .toolbar .add_sub_action ("Physic Material" , "Assets" , "Create" , "" , "" , testing ("new phys mat" ))
61-
62- self .window .toolbar .add_action ("Open" , "Assets" , "" , "Opens the selected asset" , testing ("open asset" ))
63- self .window .toolbar .add_action ("Delete" , "Assets" , "" , "Deletes the selected asset" , testing ("del asset" ))
64-
65- self .window .toolbar .add_action ("Toggle Theme" , "Window" , "Ctrl+L" , "Toggle theme between light and dark" , self .window .toggle_theme )
66-
6726 self .buttons = SceneButtons (self .window )
6827 self .buttons .add_button ("play.png" , "Run the scene" )
6928 self .buttons .add_button ("pause.png" , "Pause the scene" )
@@ -100,6 +59,8 @@ def __init__(self, path):
10059 self .console_content .add_entry (time .strftime ("%Y-%m-%d %H:%M:%S" ), Logger .OUTPUT , "Test" )
10160 self .game_content .console = self .console_content
10261
62+ self .setup_toolbar ()
63+
10364 def start (self ):
10465 self .window .showMaximized ()
10566 os .environ ["PYUNITY_EDITOR_LOADED" ] = "1"
@@ -123,3 +84,46 @@ def quit_wrapper(self):
12384 ret = message_box .exec ()
12485 if ret == QMessageBox .Ok :
12586 self .quit ()
87+
88+ def setup_toolbar (self ):
89+ self .window .toolbar .add_action ("New" , "File" , "Ctrl+N" , "Create a new project" , testing ("new" ))
90+ self .window .toolbar .add_action ("Open" , "File" , "Ctrl+O" , "Open an existing project" , self .open )
91+ self .window .toolbar .add_action ("Save" , "File" , "Ctrl+S" , "Save the current Scene" , self .save )
92+ self .window .toolbar .add_action ("Save As" , "File" , "Ctrl+Shift+S" , "Save the current Scene as new file" , testing ("save as" ))
93+ self .window .toolbar .add_action ("Save a Copy As" , "File" , "Ctrl+Alt+S" , "Save a copy of the current Scene" , testing ("save copy as" ))
94+ self .window .toolbar .add_separator ("File" )
95+ self .window .toolbar .add_action ("Close Scene" , "File" , "Ctrl+W" , "Closes the current Scene" , testing ("close" ))
96+ self .window .toolbar .add_action ("Close All" , "File" , "Ctrl+Shift+W" , "Closes all opened Scene" , testing ("close all" ))
97+ self .window .toolbar .add_separator ("File" )
98+ self .window .toolbar .add_action ("Quit" , "File" , "Ctrl+Q" , "Close the Editor" , self .quit_wrapper )
99+
100+ self .window .toolbar .add_action ("Undo" , "Edit" , "Ctrl+Z" , "Undo the last action" , testing ("undo" ))
101+ self .window .toolbar .add_action ("Redo" , "Edit" , "Ctrl+Shift+Z" , "Redo the last action" , testing ("redo" ))
102+ self .window .toolbar .add_separator ("Edit" )
103+ self .window .toolbar .add_action ("Cut" , "Edit" , "Ctrl+X" , "Deletes item and adds to clipboard" , testing ("cut" ))
104+ self .window .toolbar .add_action ("Copy" , "Edit" , "Ctrl+C" , "Adds item to clipboard" , testing ("copy" ))
105+ self .window .toolbar .add_action ("Paste" , "Edit" , "Ctrl+V" , "Pastes item from clipboard" , testing ("paste" ))
106+ self .window .toolbar .add_separator ("Edit" )
107+ self .window .toolbar .add_action ("Rename" , "Edit" , "F2" , "Renames the selected item" , testing ("rename" ))
108+ self .window .toolbar .add_action ("Duplicate" , "Edit" , "Ctrl+D" , "Duplicates the selected item(s)" , testing ("duplicate" ))
109+ self .window .toolbar .add_action ("Delete" , "Edit" , "Delete" , "Deletes item" , self .hierarchy_content .remove )
110+ self .window .toolbar .add_separator ("Edit" )
111+ self .window .toolbar .add_action ("Select All" , "Edit" , "Ctrl+A" , "Selects all items in the current Scene" , self .hierarchy_content .tree_widget .selectAll )
112+ self .window .toolbar .add_action ("Select None" , "Edit" , "Escape" , "Deselects all items" , self .window .select_none )
113+
114+ self .window .toolbar .add_sub_action ("Folder" , "Assets" , "Create" , "" , "" , testing ("new folder" ))
115+ self .window .toolbar .add_sub_action ("File" , "Assets" , "Create" , "" , "" , testing ("new file" ))
116+ self .window .toolbar .add_sub_separator ("Assets" , "Create" )
117+ self .window .toolbar .add_sub_action ("Script" , "Assets" , "Create" , "" , "" , testing ("new script" ))
118+ self .window .toolbar .add_sub_separator ("Assets" , "Create" )
119+ self .window .toolbar .add_sub_action ("Scene" , "Assets" , "Create" , "" , "" , testing ("new scene" ))
120+ self .window .toolbar .add_sub_action ("Prefab" , "Assets" , "Create" , "" , "" , testing ("new prefab" ))
121+ self .window .toolbar .add_sub_action ("Material" , "Assets" , "Create" , "" , "" , testing ("new mat" ))
122+ self .window .toolbar .add_sub_separator ("Assets" , "Create" )
123+ self .window .toolbar .add_sub_action ("Physic Material" , "Assets" , "Create" , "" , "" , testing ("new phys mat" ))
124+
125+ self .window .toolbar .add_action ("Open" , "Assets" , "" , "Opens the selected asset" , testing ("open asset" ))
126+ self .window .toolbar .add_action ("Delete" , "Assets" , "" , "Deletes the selected asset" , testing ("del asset" ))
127+
128+ self .window .toolbar .add_action ("Toggle Theme" , "Window" , "Ctrl+L" , "Toggle theme between light and dark" , self .window .toggle_theme )
129+
0 commit comments