Commits

Ronny Pfannschmidt committed 73a680f

automated action rewrite of pida/services/language/language.py
actionsconfig: 347 481
actions:
language_type on_type_change h
show_all_types None
language_type_menu on_type_menu h
show_validator on_show_validator
show_outliner on_show_browser h
goto_definition on_goto_definition
show_documentation on_documentation h
language_refresh on_refresh h
focus_outline_browser on_focus_outline h
show_language_prio on_show_language_prio
methods:
def create_actions(self):
'goto_definition',
_('Goto the definition of current word'),
self.on_goto_definition,
def on_type_change(self, action): -> language_type
def on_type_menu(self, action): -> language_type_menu
def on_show_validator(self, action):
def on_show_browser(self, action): -> show_outliner
def on_goto_definition(self, action):
self.svc.goto_defintion()
def on_documentation(self, action): -> show_documentation
def on_refresh(self, action): -> language_refresh
def on_focus_outline(self, action): -> focus_outline_browser
def on_show_language_prio(self, action):

Comments (0)

Files changed (1)

pida/services/language/language.py

 
 
 class LanguageActionsConfig(ActionsConfig):
-    def create_actions(self):
-        self.create_action(
-            'language_type',
-            PidaMenuToolAction,
+
+    actions = [
+        PidaMenuToolAction('language_type',
             _('_Type'),
             _('Select Document Type'),
-            'package_utilities',
-            self.on_type_change,
-        )
-
-        self.create_action(
-            'show_all_types',
-            PidaRememberToggle,
+            'package_utilities'),
+        PidaRememberToggle('show_all_types',
             _('Show All Types'),
             _('Show all available types'),
-            '',
-        )
-
-        self.create_action(
-            'language_type_menu',
-            gtk.Action,
+            ''),
+        gtk.Action('language_type_menu',
             _('_Type'),
             _('Select document type'),
-            gtk.STOCK_EXECUTE,
-            self.on_type_menu,
-        )
-        
-        #XXX: remember
-        self.create_action(
-            'show_validator',
-            PidaRememberToggle,
+            gtk.STOCK_EXECUTE),
+        PidaRememberToggle('show_validator',
             _('_Validator'),
             _('Show the language validator'),
-            'error',
-            self.on_show_validator,
-        )
-        #XXX: remember
-        self.create_action(
-            'show_outliner',
-            PidaRememberToggle,
+            'error'),
+        PidaRememberToggle('show_outliner',
             _('_Outliner'),
             _('Show the language browser'),
-            'info',
-            self.on_show_browser,
-        )
-
-        self.create_action(
-            'goto_definition',
-            gtk.Action,
+            'info'),
+        gtk.Action('goto_definition',
             _('Goto _Definition'),
             _('Goto the definition of current word'),
-            'goto',
-            self.on_goto_definition,
-            '<Control>F5'
-        )
-        self.create_action(
-            'show_documentation',
-            gtk.Action,
+            'goto'),
+        gtk.Action('show_documentation',
             _('Show Documentation'),
             _('Show the documentation of cursor position'),
-            'help',
-            self.on_documentation,
-            '<Control>F1'
-        )
-        self.create_action(
-            'language_refresh',
-            gtk.Action,
+            'help'),
+        gtk.Action('language_refresh',
             _('Refresh'),
             _('Refresh all caches'),
-            gtk.STOCK_REFRESH,
-            self.on_refresh,
-            ''
-        )
-        self.create_action(
-            'focus_outline_browser',
-            gtk.Action,
+            gtk.STOCK_REFRESH),
+        gtk.Action('focus_outline_browser',
             _('Focus outline filter'),
             _('Show outline browser and focus filter entry'),
-            '',
-            self.on_focus_outline,
-            '',
-            global_=True
-        )
-        self.create_action(
-            'show_language_prio',
-            gtk.ToggleAction,
+            ''),
+        gtk.ToggleAction('show_language_prio',
             _('_Plugin Priorities'),
             _('Configure priorities for language plugins'),
-            'info',
-            self.on_show_language_prio,
-        )
+            'info'),
+    ]
 
+    accels = {
+        'goto_definition': '<Control>F5',
+        'show_documentation': '<Control>F1',
+        'language_refresh': '',
+    }
 
-    def on_type_change(self, action):
+    global_accels = {
+        'focus_outline_browser': '',
+    }
+
+    def on_language_type(self, action):
         pass
 
-    def on_type_menu(self, action):
+    def on_language_type_menu(self, action):
         menuitem = action.get_proxies()[0]
         menuitem.remove_submenu()
         menuitem.set_submenu(self.svc.create_menu())
         else:
             self.svc.hide_validator()
 
-    def on_show_browser(self, action):
+    def on_show_outliner(self, action):
         if action.get_active():
             self.svc.show_browser()
         else:
     def on_goto_definition(self, action):
         self.svc.goto_defintion()
 
-    def on_documentation(self, action):
+    def on_show_documentation(self, action):
         self.svc.show_documentation()
 
-    def on_refresh(self, action):
+    def on_language_refresh(self, action):
         self.svc.emit('refresh')
 
-    def on_focus_outline(self, action):
+    def on_focus_outline_browser(self, action):
         self.get_action('show_outliner').set_active(True)
         self.svc.boss.cmd('window', 'present_view',
                           view=self.svc._view_outliner)