Esempio n. 1
0
 def __init__(self):
     
     rename_process('telecentros')
     mkdir(CACHE_PATH)
     logging.info('Starting Telecentros Client')
     self.conf_client = get_default_client()
     
     if not self.conf_client.get_string('hash_id'):
         self.conf_client.set_string('hash_id',
                                      generate_id_bytime()) #Generate Hash_ID
     
     if not self.conf_client.get_string('server'):
         dlg = dialogs.ConnectServer()
         host = dlg.run()
         
         if host:
             self.conf_client.set_string('server',
                                          host)
         else:
             sys.exit(0)
Esempio n. 2
0
    def __init__(self):
        
        self.logger = logging.getLogger('client.main')
        self.conf_client = get_default_client()
        self.dbus_manager = DbusManager(self)
        self.script_manager = ScriptManager()
        self.proxy_setter = ProxySetter()

        if pynotify and not pynotify.is_initted():
            pynotify.init('telecentros')

        # Get operating system version
        o = get_os()
        if o[0]:
            self.os_name = o[0]
        if o[1]:
            self.os_version = o[1]
        
        self.mac_id = get_route_mac_address()
        self.server = self.conf_client.get_string('server')
        self.port = self.conf_client.get_int('port')
        
        if not self.port:
            self.port = 80
    
        self.json_requester = JSONRequester(self.server, self.port)
        self.json_requester.run()
        self.json_requester.request('POST', {'cmd': 'identify', 'mac': self.mac_id, 'os_name': self.os_name,
                                             'os_version': self.os_version},
                                    self.on_identify_response, None)
        
        #icons
        self.icons = icons.Icons()
        self.logo = self.icons.get_icon(CLIENT_ICON_NAME)
        
        #MainWindow
        self.xml = get_gtk_builder('main')
        self.main_window = self.xml.get_object('window')
        self.time_str = self.xml.get_object('time_str')
        self.elapsed_pb = self.xml.get_object('elapsed_pb')
        self.remaining_pb = self.xml.get_object('remaining_pb')
        self.full_name = self.xml.get_object('full_name')
        self.tray_menu = self.xml.get_object('tray_menu')
        self.show_window_menu = self.xml.get_object('show_window_menu')
        
        self.main_window.set_icon_name('telecentros')
        self.main_window.show()
        
        self.visible = True
        self.show_window_menu.set_active(True)
        
        self.xml.connect_signals(self)
        
        #Tray
        self.tray_icon = gtk.status_icon_new_from_icon_name("telecentros")
        self.tray_icon.set_tooltip(_("TeleCentros"))
        
        self.tray_icon.connect('popup-menu', self.on_tray_popup_menu)
        self.tray_icon.connect('activate', self.on_show_hide)
        
        #Login Window
        self.login_window = login.Login(self)
        self.login_window.run()