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

Commits:
9ed0edf3 by Philipp Hörist at 2018-02-02T00:21:27+01:00
Port ipython command from gajim-remote

- - - - -


2 changed files:

- gajim/app_actions.py
- gajim/gajim.py


Changes:

=====================================
gajim/app_actions.py
=====================================
--- a/gajim/app_actions.py
+++ b/gajim/app_actions.py
@@ -274,3 +274,15 @@ class AppActions():
         app.interface.handle_event(dict_['account'], dict_['jid'],
             dict_['type_'])
 
+
+    # Other Actions
+
+    def toggle_ipython(self, action, param):
+        """
+        Show/hide the ipython window
+        """
+        win = app.ipython_window
+        if win and win.window.is_visible():
+            win.present()
+        else:
+           app.interface.create_ipython_window()


=====================================
gajim/gajim.py
=====================================
--- a/gajim/gajim.py
+++ b/gajim/gajim.py
@@ -91,6 +91,9 @@ class GajimApplication(Gtk.Application):
         self.add_main_option('warnings', ord('w'), GLib.OptionFlags.NONE,
                              GLib.OptionArg.NONE,
                              _('Show all warnings'))
+        self.add_main_option('ipython', ord('i'), GLib.OptionFlags.NONE,
+                             GLib.OptionArg.NONE,
+                             _('open ipython shell'))
 
         self.connect('handle-local-options', self._handle_local_options)
         self.connect('startup', self._startup)
@@ -294,6 +297,11 @@ class GajimApplication(Gtk.Application):
             app_id = '%s.%s' % (self.get_application_id(), profile)
             self.set_application_id(app_id)
             self.profile = profile
+
+        # Register the Application, so it knows if its primary or not
+        # This is needed so we can execute actions on the remote instance
+        self.register(None)
+
         if options.contains('separate'):
             self.profile_separation = True
         if options.contains('config-path'):
@@ -311,6 +319,9 @@ class GajimApplication(Gtk.Application):
             logging_helpers.set_loglevels(loglevel)
         if options.contains('warnings'):
             self.show_warnings()
+        if options.contains('ipython'):
+            self.activate_action('ipython')
+            return 0
         return -1
 
     def show_warnings(self):
@@ -386,6 +397,7 @@ class GajimApplication(Gtk.Application):
             ('content', action.on_contents),
             ('about', action.on_about),
             ('faq', action.on_faq),
+            ('ipython', action.toggle_ipython),
         ]
 
         act = Gio.SimpleAction.new('add-contact', GLib.VariantType.new('s'))



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/9ed0edf331e8163529ebe26eca3c588da072a326

---
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/9ed0edf331e8163529ebe26eca3c588da072a326
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to