1
1
import sys
2
2
3
3
from PyQt6 .QtCore import Qt
4
- from PyQt6 .QtWidgets import QMainWindow , QApplication , QLabel , QProgressBar
4
+ from PyQt6 .QtWidgets import QMainWindow , QApplication , QLabel , QProgressBar , QFileDialog
5
5
6
+ from configuration .config_manager import ConfigManager
6
7
from prototype_ui .actions import Actions
7
8
from prototype_ui .menubar import MenuBarManager
8
9
from prototype_ui .toolbar import ToolBarManager
13
14
class MainWindow (QMainWindow ):
14
15
def __init__ (self ):
15
16
super ().__init__ ()
17
+ #
18
+ # First of all, get config manager up and running so we have access to any settings that it manages for us
19
+ #
20
+ self ._config_manager = ConfigManager ()
21
+
22
+ # PROTOTYPE FROM HERE
16
23
17
24
self .setMinimumSize (200 , 200 )
18
25
self .resize (1800 , 400 )
@@ -34,6 +41,7 @@ def __init__(self):
34
41
self ._tool_bar_manager = ToolBarManager (self .addToolBar ("Main" ), self ._actions )
35
42
36
43
# Connect actions with callback methods to implement them
44
+ self ._actions .change_directory .triggered .connect (self ._change_directory )
37
45
self ._actions .file_new .triggered .connect (self ._new_file )
38
46
self ._actions .file_open .triggered .connect (self ._open_file )
39
47
@@ -58,6 +66,12 @@ def _new_file(self):
58
66
def _open_file (self ):
59
67
self .canvas .setCursor (Qt .CursorShape .CrossCursor )
60
68
69
+ def _change_directory (self ):
70
+ new_directory = QFileDialog .getExistingDirectory (self , self ._actions .change_directory .statusTip (), self ._config_manager .get_log_directory ())
71
+ if new_directory != "" :
72
+ self ._config_manager .set_log_directory (new_directory )
73
+ # self.menu_bar.refresh() # TODO - Equivalent in new UI is to be determined
74
+
61
75
62
76
if __name__ == '__main__' :
63
77
app = QApplication ([])
0 commit comments