@@ -42,8 +42,8 @@ class CommanderWindow(QtGui.QDialog):
42
42
def __init__ (self , parent , canvas ):
43
43
self .canvas = canvas
44
44
QtGui .QDialog .__init__ (self , parent , Qt .FramelessWindowHint )
45
- self .setModal (True )
46
- self .commands = imp .load_source ("commands" , self .commandsFile ())
45
+ # self.setModal(True)
46
+ self .commands = imp .load_source ("commands" , self .commandsFile ())
47
47
self .initGui ()
48
48
49
49
def commandsFolder (self ):
@@ -65,29 +65,14 @@ def commandsFile(self):
65
65
out .close ()
66
66
return f
67
67
68
+ def algsListHasChanged (self ):
69
+ self .fillCombo ()
68
70
69
71
def initGui (self ):
70
- self .combo = ExtendedComboBox ()
71
- #add algorithm
72
- for providerName in Sextante .algs .keys ():
73
- provider = Sextante .algs [providerName ]
74
- algs = provider .values ()
75
- for alg in algs :
76
- self .combo .addItem ("SEXTANTE algorithm: " + alg .name )
77
- #add functions
78
- for command in dir (self .commands ):
79
- if isinstance (self .commands .__dict__ .get (command ), types .FunctionType ):
80
- self .combo .addItem ("Command: " + command );
81
- #add menu entries
82
- menuActions = []
83
- actions = Sextante .getInterface ().mainWindow ().menuBar ().actions ()
84
- for action in actions :
85
- menuActions .extend (self .getActions (action ))
86
- for action in menuActions :
87
- self .combo .addItem ("Menu action: " + unicode (action .text ()))
72
+ self .combo = ExtendedComboBox ()
73
+ self .fillCombo ()
88
74
89
75
self .combo .setEditable (True )
90
- self .combo .setEditText ("" )
91
76
self .label = QtGui .QLabel ("Enter command:" )
92
77
self .errorLabel = QtGui .QLabel ("Enter command:" )
93
78
self .vlayout = QtGui .QVBoxLayout ()
@@ -104,6 +89,31 @@ def initGui(self):
104
89
self .vlayout .addSpacerItem (QtGui .QSpacerItem (0 , OFFSET , QSizePolicy .Maximum , QSizePolicy .Expanding ));
105
90
self .setLayout (self .vlayout )
106
91
self .combo .lineEdit ().returnPressed .connect (self .run )
92
+ self .prepareGui ()
93
+
94
+ def fillCombo (self ):
95
+ self .combo .clear ()
96
+ #add algorithms
97
+ for providerName in Sextante .algs .keys ():
98
+ provider = Sextante .algs [providerName ]
99
+ algs = provider .values ()
100
+ for alg in algs :
101
+ self .combo .addItem ("SEXTANTE algorithm: " + alg .name )
102
+ #add functions
103
+ for command in dir (self .commands ):
104
+ if isinstance (self .commands .__dict__ .get (command ), types .FunctionType ):
105
+ self .combo .addItem ("Command: " + command );
106
+ #add menu entries
107
+ menuActions = []
108
+ actions = Sextante .getInterface ().mainWindow ().menuBar ().actions ()
109
+ for action in actions :
110
+ menuActions .extend (self .getActions (action ))
111
+ for action in menuActions :
112
+ self .combo .addItem ("Menu action: " + unicode (action .text ()))
113
+
114
+
115
+ def prepareGui (self ):
116
+ self .combo .setEditText ("" )
107
117
self .combo .setMaximumSize (QtCore .QSize (self .canvas .rect ().width () - 2 * OFFSET , ITEMHEIGHT ))
108
118
self .combo .view ().setStyleSheet ("min-height: 150px" )
109
119
self .combo .setFocus (Qt .OtherFocusReason )
0 commit comments