@@ -223,7 +223,7 @@ def registerAction(self, action, menuName, callback=None):
223
223
# get the placeholder's position to insert before it
224
224
pos = 0
225
225
for pos in range (len (menuActions )):
226
- if menuActions [pos ].isSeparator () and menuActions [pos ].text () == "placeholder" :
226
+ if menuActions [pos ].isSeparator () and menuActions [pos ].objectName (). endsWith ( "_placeholder" ) :
227
227
menuActions [pos ].setVisible (True )
228
228
break
229
229
@@ -301,7 +301,7 @@ def unregisterAction(self, action, menuName):
301
301
# hide the placeholder if there're no other registered actions
302
302
if len (self ._registeredDbActions [menuName ]) <= 0 :
303
303
for i in range (len (menuActions )):
304
- if menuActions [i ].isSeparator () and menuActions [i ].text () == "placeholder" :
304
+ if menuActions [i ].isSeparator () and menuActions [i ].objectName (). endsWith ( "_placeholder" ) :
305
305
menuActions [i ].setVisible (False )
306
306
break
307
307
@@ -369,18 +369,18 @@ def setupUi(self):
369
369
# create menus' actions
370
370
371
371
# menu DATABASE
372
- sep = self .menuDb .addAction ( "placeholder" ); sep .setSeparator ( True ); sep .setVisible (False )
372
+ sep = self .menuDb .addSeparator ( ); sep .setObjectName ( "DB_Manager_DbMenu_placeholder" ); sep .setVisible (False )
373
373
self .actionRefresh = self .menuDb .addAction ( QIcon (":/db_manager/actions/refresh" ), "&Refresh" , self .refreshActionSlot , QKeySequence ("F5" ) )
374
374
self .actionSqlWindow = self .menuDb .addAction ( QIcon (":/db_manager/actions/sql_window" ), "&SQL window" , self .runSqlWindow , QKeySequence ("F2" ) )
375
375
self .menuDb .addSeparator ()
376
376
self .actionClose = self .menuDb .addAction ( QIcon (), "&Exit" , self .close , QKeySequence ("CTRL+Q" ) )
377
377
378
378
# menu SCHEMA
379
- sep = self .menuSchema .addAction ( "placeholder" ); sep .setSeparator ( True ); sep .setVisible (False )
379
+ sep = self .menuSchema .addSeparator ( ); sep .setObjectName ( "DB_Manager_SchemaMenu_placeholder" ); sep .setVisible (False )
380
380
actionMenuSchema .setVisible (False )
381
381
382
382
# menu TABLE
383
- sep = self .menuTable .addAction ( "placeholder" ); sep .setSeparator ( True ); sep .setVisible (False )
383
+ sep = self .menuTable .addSeparator ( ); sep .setObjectName ( "DB_Manager_TableMenu_placeholder" ); sep .setVisible (False )
384
384
actionMenuTable .setVisible (False )
385
385
self .actionShowSystemTables = self .menuTable .addAction ("Show system tables/views" , self .showSystemTables )
386
386
self .actionShowSystemTables .setCheckable (True )
0 commit comments