[Xfce4-commits] [apps/xfce4-panel-profiles] 113/162: Move supported save and load commandline parameters to the main binary (LP: #1556737)
noreply at xfce.org
noreply at xfce.org
Fri Jul 13 13:10:12 CEST 2018
This is an automated email from the git hooks/post-receive script.
o c h o s i p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/xfce4-panel-profiles.
commit e9be5ec7e61729e6b4179302dc4c31ffb5a5d246
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Sun Mar 25 22:36:06 2018 -0400
Move supported save and load commandline parameters to the main binary (LP: #1556737)
---
xfpanel-switch/panelconfig.py | 36 ------------------------------------
xfpanel-switch/xfpanel-switch.py | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 36 deletions(-)
diff --git a/xfpanel-switch/panelconfig.py b/xfpanel-switch/panelconfig.py
index 91ae724..75fab2a 100644
--- a/xfpanel-switch/panelconfig.py
+++ b/xfpanel-switch/panelconfig.py
@@ -200,39 +200,3 @@ class PanelConfig(object):
dbus_proxy.call_sync('Terminate', GLib.Variant('(b)', ('xfce4-panel',)), 0, -1, None)
except GLib.GError:
pass
-
-
-if __name__ == '__main__':
-
- import sys
-
- session_bus = Gio.BusType.SESSION
- cancellable = None
- connection = Gio.bus_get_sync(session_bus, cancellable)
-
- proxy_property = 0
- interface_properties_array = None
- destination = 'org.xfce.Xfconf'
- path = '/org/xfce/Xfconf'
- interface = destination
-
- xfconf = Gio.DBusProxy.new_sync(
- connection,
- proxy_property,
- interface_properties_array,
- destination,
- path,
- interface,
- cancellable)
-
- if len(sys.argv) != 3 or sys.argv[1] not in ['load', 'save']:
- print('Panel Switch v0.1 - Usage:')
- print(sys.argv[0] + ' save <filename> : save current configuration.')
- print(sys.argv[0] + ' load <filename> : load configuration from file.')
- print('')
- exit(-1)
-
- if sys.argv[1] == 'save':
- PanelConfig.from_xfconf(xfconf).to_file(sys.argv[2])
- elif sys.argv[1] == 'load':
- PanelConfig.from_file(sys.argv[2]).to_xfconf(xfconf)
diff --git a/xfpanel-switch/xfpanel-switch.py b/xfpanel-switch/xfpanel-switch.py
index 96952ef..41ad34b 100644
--- a/xfpanel-switch/xfpanel-switch.py
+++ b/xfpanel-switch/xfpanel-switch.py
@@ -316,5 +316,45 @@ class PanelSaveDialog(Gtk.MessageDialog):
self.entry.set_text(name.strip())
if __name__ == "__main__":
+ import sys
+
+ if len(sys.argv) > 1:
+ if sys.argv[1] in ['save', 'load']:
+ session_bus = Gio.BusType.SESSION
+ cancellable = None
+ connection = Gio.bus_get_sync(session_bus, cancellable)
+
+ proxy_property = 0
+ interface_properties_array = None
+ destination = 'org.xfce.Xfconf'
+ path = '/org/xfce/Xfconf'
+ interface = destination
+
+ xfconf = Gio.DBusProxy.new_sync(
+ connection,
+ proxy_property,
+ interface_properties_array,
+ destination,
+ path,
+ interface,
+ cancellable)
+
+ try:
+ if sys.argv[1] == 'save':
+ PanelConfig.from_xfconf(xfconf).to_file(sys.argv[2])
+ elif sys.argv[1] == 'load':
+ PanelConfig.from_file(sys.argv[2]).to_xfconf(xfconf)
+ except Exception as e:
+ print(repr(e))
+ exit(1)
+ exit(0)
+ else:
+ print('Xfce Panel Switch - Usage:')
+ print(sys.argv[0] + ' : load graphical user interface.')
+ print(sys.argv[0] + ' save <filename> : save current configuration.')
+ print(sys.argv[0] + ' load <filename> : load configuration from file.')
+ print('')
+ exit(-1)
+
main = XfpanelSwitch()
Gtk.main()
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list