Merge lp:~ballogy/gloobus-preview/gloobus-sushi into lp:gloobus-preview

Proposed by Balló György
Status: Merged
Merged at revision: 302
Proposed branch: lp:~ballogy/gloobus-preview/gloobus-sushi
Merge into: lp:gloobus-preview
Diff against target: 254 lines (+117/-25)
8 files modified
configure.ac (+2/-0)
data/Makefile.am (+11/-1)
data/net.gloobus.Sushi.service.in (+3/-0)
src/Makefile.am (+1/-0)
src/gloobus-preview-configuration (+24/-24)
src/gloobus-sushi/Makefile.am (+22/-0)
src/gloobus-sushi/gloobus-sushi.in (+3/-0)
src/gloobus-sushi/gloobus-sushi.py (+51/-0)
To merge this branch: bzr merge lp:~ballogy/gloobus-preview/gloobus-sushi
Reviewer Review Type Date Requested Status
Gloobus Developers Pending
Review via email: mp+245345@code.launchpad.net

Description of the change

Megre gloobus-sushi into gloobus-preview

At the same time, the following changes happened:

- Port gloobus-sushi to pygobject 3.

- Port gloobus-preview-configuration and gloobus-sushi to python 3.

- Rename the service file to 'net.gloobus.Sushi.service', so it will be not in file conflict with sushi.

To post a comment you must log in.
299. By Balló György

Move gloobus-sushi script to the common gloobus data dir

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2014-12-25 16:21:13 +0000
3+++ configure.ac 2014-12-25 16:26:14 +0000
4@@ -20,6 +20,7 @@
5 AC_PROG_LIBTOOL # To create libraries
6 AC_PROG_INSTALL
7 AC_PROG_MAKE_SET # Compile more than one Makefiles
8+AM_PATH_PYTHON([3.0])
9
10 # *** checks for boost ******************************************************* #
11 AX_BOOST_BASE([1.39.0])
12@@ -91,6 +92,7 @@
13 src/plugin-xps/Makefile
14 src/loaders/PSD/Makefile
15 src/loaders/XCF/Makefile
16+ src/gloobus-sushi/Makefile
17 data/Makefile
18 data/images/Makefile
19 data/gtkrc/Makefile
20
21=== modified file 'data/Makefile.am'
22--- data/Makefile.am 2010-01-13 18:08:07 +0000
23+++ data/Makefile.am 2014-12-25 16:26:14 +0000
24@@ -3,6 +3,16 @@
25 desktopdir = $(datadir)/applications
26 desktop_DATA = gloobus-preview.desktop
27
28+servicedir = $(datadir)/dbus-1/services
29+service_in_files = net.gloobus.Sushi.service.in
30+service_DATA = $(service_in_files:.service.in=.service)
31+
32+net.gloobus.Sushi.service: net.gloobus.Sushi.service.in Makefile
33+ $(AM_V_GEN) sed -e "s|\@bindir\@|$(bindir)|" $< > $@
34+
35 EXTRA_DIST = \
36- $(desktop_DATA)
37+ $(desktop_DATA) \
38+ $(service_in_files)
39
40+CLEANFILES = \
41+ $(service_DATA)
42
43=== added file 'data/net.gloobus.Sushi.service.in'
44--- data/net.gloobus.Sushi.service.in 1970-01-01 00:00:00 +0000
45+++ data/net.gloobus.Sushi.service.in 2014-12-25 16:26:14 +0000
46@@ -0,0 +1,3 @@
47+[D-BUS Service]
48+Name=org.gnome.NautilusPreviewer
49+Exec=@bindir@/gloobus-sushi
50
51=== modified file 'src/Makefile.am'
52--- src/Makefile.am 2014-12-25 16:21:13 +0000
53+++ src/Makefile.am 2014-12-25 16:26:14 +0000
54@@ -1,4 +1,5 @@
55 SUBDIRS = \
56+ gloobus-sushi \
57 loaders/PSD \
58 loaders/XCF \
59 plugin-comic \
60
61=== modified file 'src/gloobus-preview-configuration'
62--- src/gloobus-preview-configuration 2014-12-23 10:46:19 +0000
63+++ src/gloobus-preview-configuration 2014-12-25 16:26:14 +0000
64@@ -1,8 +1,8 @@
65-#!/usr/bin/python
66+#!/usr/bin/python3
67
68 # Gloobus-config by BadChoice <guitarboy000@gmail.com>
69
70-import ConfigParser
71+import configparser
72 import os
73 import sys
74 import glob
75@@ -43,16 +43,16 @@
76 #================= PREDEFINED MACROS =======================#
77 def debug(self,string):
78 if self.debugMode:
79- print self.level('debug') + "[DEBUG] " + self.level('reset') + string
80+ print(self.level('debug') + "[DEBUG] " + self.level('reset') + string)
81
82 def info(self,string):
83- print self.level('info') + "[INFO] " + self.level('reset') + string
84+ print(self.level('info') + "[INFO] " + self.level('reset') + string)
85
86 def warning(self,string):
87- print self.level('warning') + "[WARNING] " + self.level('reset') + string
88+ print(self.level('warning') + "[WARNING] " + self.level('reset') + string)
89
90 def error(self,string):
91- print self.level('error') + "[ERROR] " + self.level('reset') + string
92+ print(self.level('error') + "[ERROR] " + self.level('reset') + string)
93
94
95 #=========================== CLASS GUI =======================================================#
96@@ -70,9 +70,9 @@
97
98 schema_source = Gio.SettingsSchemaSource.get_default()
99 wm_schema =Gio.SettingsSchemaSource.lookup(schema_source, "org.gnome.desktop.wm.preferences", False)
100- if wm_schema:
101- wm_settings = Gio.Settings.new("org.gnome.desktop.wm.preferences")
102- self.gsettings_win_layout = wm_settings.get_string("button-layout")
103+ if wm_schema:
104+ wm_settings = Gio.Settings.new("org.gnome.desktop.wm.preferences")
105+ self.gsettings_win_layout = wm_settings.get_string("button-layout")
106
107 #================= Show In Taskbar ================= #
108 self.entry1 = Gtk.CheckButton(label=_("Show in TaskBar"), use_underline=False)
109@@ -163,7 +163,7 @@
110 #==================================== GLOBAL FUNCTIONS ===============================================#
111 #=================== DEFAULT CONFIGURATION ================== #
112 def config_default():
113- config = ConfigParser.SafeConfigParser()
114+ config = configparser.SafeConfigParser()
115
116 config.add_section('Main')
117 config.add_section('Theme')
118@@ -177,17 +177,17 @@
119 return config
120
121 def config_save(conf):
122- if not os.path.isfile(CONFIG_PATH):
123- p = os.path.dirname(CONFIG_PATH)
124- g.debug(_('Configuration dir path') + ": " + p)
125- if not os.path.exists(p):
126- g.warning(_("Creating configuration directory"))
127- os.makedirs(p)
128-
129- f = open(CONFIG_PATH, 'wb')
130- conf.write(f)
131- f.close()
132- g.debug('Configuration saved')
133+ if not os.path.isfile(CONFIG_PATH):
134+ p = os.path.dirname(CONFIG_PATH)
135+ g.debug(_('Configuration dir path') + ": " + p)
136+ if not os.path.exists(p):
137+ g.warning(_("Creating configuration directory"))
138+ os.makedirs(p)
139+
140+ f = open(CONFIG_PATH, 'w')
141+ conf.write(f)
142+ f.close()
143+ g.debug('Configuration saved')
144
145 # ================== LOAD CONFIG ================#
146 def config_load():
147@@ -221,12 +221,12 @@
148
149
150
151-try:
152+try:
153 if sys.argv[1] == "--debug":
154- g.set_debug(True)
155+ g.set_debug(True)
156 debug=True
157 g.info(_("MODE DEBUG:ON"))
158-
159+
160 except:
161 g.info(_("MODE DEBUG:OFF"))
162
163
164=== added directory 'src/gloobus-sushi'
165=== added file 'src/gloobus-sushi/Makefile.am'
166--- src/gloobus-sushi/Makefile.am 1970-01-01 00:00:00 +0000
167+++ src/gloobus-sushi/Makefile.am 2014-12-25 16:26:14 +0000
168@@ -0,0 +1,22 @@
169+do_subst = sed \
170+ -e s![@]PYTHON[@]![@]PYTHON[@]! \
171+ -e s![@]prefix[@]!$(prefix)!g \
172+ -e s![@]sysconfdir[@]!$(sysconfdir)!g \
173+ -e s![@]datadir[@]!$(datadir)!g \
174+ -e s![@]pkgdatadir[@]!$(pkgdatadir)!g \
175+ -e s![@]libexecdir[@]!$(libexecdir)!g \
176+ -e s![@]libdir[@]!$(libdir)!g \
177+ -e s![@]PACKAGE[@]!$(PACKAGE)!g \
178+ -e s![@]VERSION[@]!$(VERSION)!g \
179+ -e s![@]REVNO[@]!$(REVNO)!g
180+
181+bin_SCRIPTS = gloobus-sushi
182+
183+gloobussushidir = $(datadir)/gloobus
184+gloobussushi_PYTHON = gloobus-sushi.py
185+
186+EXTRA_DIST = gloobus-sushi.in
187+
188+gloobus-sushi: gloobus-sushi.in
189+ $(AM_V_GEN) $(do_subst) $< > $@
190+ chmod +x $@
191
192=== added file 'src/gloobus-sushi/gloobus-sushi.in'
193--- src/gloobus-sushi/gloobus-sushi.in 1970-01-01 00:00:00 +0000
194+++ src/gloobus-sushi/gloobus-sushi.in 2014-12-25 16:26:14 +0000
195@@ -0,0 +1,3 @@
196+#!/bin/bash
197+
198+python3 @datadir@/gloobus/gloobus-sushi.py
199
200=== added file 'src/gloobus-sushi/gloobus-sushi.py'
201--- src/gloobus-sushi/gloobus-sushi.py 1970-01-01 00:00:00 +0000
202+++ src/gloobus-sushi/gloobus-sushi.py 2014-12-25 16:26:14 +0000
203@@ -0,0 +1,51 @@
204+# Copyright (C) 2009-2010 Gloobus Developers
205+#
206+#This program is free software; you can redistribute it and/or
207+#modify it under the terms of the GNU General Public License
208+#as published by the Free Software Foundation; either version 2
209+#of the License, or (at your option) any later version.
210+#
211+#This program is distributed in the hope that it will be useful,
212+#but WITHOUT ANY WARRANTY; without even the implied warranty of
213+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
214+#GNU General Public License for more details.
215+#
216+#You should have received a copy of the GNU General Public License
217+#along with this program; if not, write to the Free Software
218+#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
219+
220+import dbus
221+import dbus.service
222+from gi.repository import GObject
223+import os
224+
225+from dbus.mainloop.glib import DBusGMainLoop
226+
227+DBUS_NAME = 'org.gnome.NautilusPreviewer'
228+DBUS_PATH = '/org/gnome/NautilusPreviewer'
229+
230+class DBusWrapper(dbus.service.Object):
231+ def __init__(self):
232+ bus_name = dbus.service.BusName(DBUS_NAME, bus=dbus.SessionBus())
233+ super(DBusWrapper, self).__init__(bus_name, DBUS_PATH)
234+ self.loop = GObject.MainLoop()
235+ self.loop.run()
236+
237+ @dbus.service.method(DBUS_NAME)
238+ def Activate(self):
239+ print('gloobus-sushi: activate')
240+
241+ @dbus.service.method(DBUS_NAME, in_signature='sib')
242+ def ShowFile(self, uri, xid, closeIfAlreadyShown):
243+ print('gloobus-sushi:', uri)
244+ os.system('gloobus-preview "%s" &' % uri)
245+
246+ @dbus.service.method(DBUS_NAME)
247+ def Close(self):
248+ print('gloobus-sushi: quit')
249+ self.loop.quit()
250+
251+
252+if __name__ == '__main__':
253+ DBusGMainLoop(set_as_default=True)
254+ wrapper = DBusWrapper()

Subscribers

People subscribed via source and target branches