Subversion Repositories basico

Rev

Rev 14 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14 Rev 15
Line 10... Line 10...
10
import imp
10
import imp
11
import signal
11
import signal
12
from os.path import abspath, sep as SEP
12
from os.path import abspath, sep as SEP
13
from configparser import SafeConfigParser, ExtendedInterpolation
13
from configparser import SafeConfigParser, ExtendedInterpolation
14
14
15
#~ from gi.repository import GObject
-
 
-
 
15
import gi
-
 
16
gi.require_version('Gtk', '3.0')
-
 
17
from gi.repository import Gtk
16
18
17
from .log import get_logger
19
from .log import get_logger
18
from .gui import GUI
20
from .gui import GUI
19
from .iconmanager import IconManager
21
from .iconmanager import IconManager
20
from .sap import SAP
22
from .sap import SAP
Line 165... Line 167...
165
        @param name: name of the service
167
        @param name: name of the service
166
        """
168
        """
167
        self.services[name].end()
169
        self.services[name].end()
168
        self.services[name] = None
170
        self.services[name] = None
169
171
-
 
172
-
 
173
    def check_gtk_version(self):
-
 
174
        vmajor = Gtk.get_major_version()
-
 
175
        vminor = Gtk.get_minor_version()
-
 
176
        vmicro = Gtk.get_micro_version()
-
 
177
        self.log.info("Found GTK+ Version: %d.%d.%d" % (vmajor, vminor, vmicro))
-
 
178
-
 
179
        if vmajor == 3 and vminor >= 18:
-
 
180
            return True
-
 
181
        else:
-
 
182
            return False
170
183
171
    def check(self):
184
    def check(self):
172
        sap = self.get_service('SAP')
-
 
173
        found = sap.check_webdriver()
-
 
174
        if not found:
-
 
175
            self.log.error("No webdriver found. Exiting.")
-
 
176
        return found
-
 
-
 
185
        GTK_VERSION = self.check_gtk_version()
-
 
186
-
 
187
        if GTK_VERSION:
-
 
188
            self.log.debug("GTK+ version supported")
-
 
189
            run = True
-
 
190
        else:
-
 
191
            self.log.error("Please, install a modern version of GTK+ (>= 3.18)")
-
 
192
            run = False
-
 
193
-
 
194
        return run
-
 
195
        #~ sap = self.get_service('SAP')
-
 
196
        #~ found = sap.check_webdriver()
-
 
197
        #~ if not found:
-
 
198
            #~ self.log.error("No webdriver found. Exiting.")
-
 
199
        #~ return found
177
200
178
201
179
    def stop(self):
202
    def stop(self):
180
        """For each service registered, it executes the 'end' method
203
        """For each service registered, it executes the 'end' method
181
        (if any) to finalize them properly.
204
        (if any) to finalize them properly.
Line 207... Line 230...
207
230
208
def main():
231
def main():
209
    #DOC: http://stackoverflow.com/questions/16410852/keyboard-interrupt-with-with-python-gtk
232
    #DOC: http://stackoverflow.com/questions/16410852/keyboard-interrupt-with-with-python-gtk
210
    signal.signal(signal.SIGINT, signal.SIG_DFL)
233
    signal.signal(signal.SIGINT, signal.SIG_DFL)
211
    basico = Basico()
234
    basico = Basico()
212
    run = True #basico.check()
-
 
-
 
235
    run = basico.check()
213
    if run:
236
    if run:
214
        basico.run()
237
        basico.run()
215
    sys.exit(0)
238
    sys.exit(0)