Philipp Hörist pushed to branch master at gajim / gajim

Commits:

2 changed files:

Changes:

  • gajim/app_actions.py
    ... ... @@ -274,3 +274,15 @@ class AppActions():
    274 274
             app.interface.handle_event(dict_['account'], dict_['jid'],
    
    275 275
                 dict_['type_'])
    
    276 276
     
    
    277
    +
    
    278
    +    # Other Actions
    
    279
    +
    
    280
    +    def toggle_ipython(self, action, param):
    
    281
    +        """
    
    282
    +        Show/hide the ipython window
    
    283
    +        """
    
    284
    +        win = app.ipython_window
    
    285
    +        if win and win.window.is_visible():
    
    286
    +            win.present()
    
    287
    +        else:
    
    288
    +           app.interface.create_ipython_window()

  • gajim/gajim.py
    ... ... @@ -91,6 +91,9 @@ class GajimApplication(Gtk.Application):
    91 91
             self.add_main_option('warnings', ord('w'), GLib.OptionFlags.NONE,
    
    92 92
                                  GLib.OptionArg.NONE,
    
    93 93
                                  _('Show all warnings'))
    
    94
    +        self.add_main_option('ipython', ord('i'), GLib.OptionFlags.NONE,
    
    95
    +                             GLib.OptionArg.NONE,
    
    96
    +                             _('open ipython shell'))
    
    94 97
     
    
    95 98
             self.connect('handle-local-options', self._handle_local_options)
    
    96 99
             self.connect('startup', self._startup)
    
    ... ... @@ -294,6 +297,11 @@ class GajimApplication(Gtk.Application):
    294 297
                 app_id = '%s.%s' % (self.get_application_id(), profile)
    
    295 298
                 self.set_application_id(app_id)
    
    296 299
                 self.profile = profile
    
    300
    +
    
    301
    +        # Register the Application, so it knows if its primary or not
    
    302
    +        # This is needed so we can execute actions on the remote instance
    
    303
    +        self.register(None)
    
    304
    +
    
    297 305
             if options.contains('separate'):
    
    298 306
                 self.profile_separation = True
    
    299 307
             if options.contains('config-path'):
    
    ... ... @@ -311,6 +319,9 @@ class GajimApplication(Gtk.Application):
    311 319
                 logging_helpers.set_loglevels(loglevel)
    
    312 320
             if options.contains('warnings'):
    
    313 321
                 self.show_warnings()
    
    322
    +        if options.contains('ipython'):
    
    323
    +            self.activate_action('ipython')
    
    324
    +            return 0
    
    314 325
             return -1
    
    315 326
     
    
    316 327
         def show_warnings(self):
    
    ... ... @@ -386,6 +397,7 @@ class GajimApplication(Gtk.Application):
    386 397
                 ('content', action.on_contents),
    
    387 398
                 ('about', action.on_about),
    
    388 399
                 ('faq', action.on_faq),
    
    400
    +            ('ipython', action.toggle_ipython),
    
    389 401
             ]
    
    390 402
     
    
    391 403
             act = Gio.SimpleAction.new('add-contact', GLib.VariantType.new('s'))