def run(): l = dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) gobject.threads_init() gtk.gdk.threads_init() if hildonize.IS_FREMANTLE_SUPPORTED: hildonize.set_application_name("FMRadio") else: hildonize.set_application_name(constants.__pretty_app_name__) gui = Gui() controller = Player(ui = gui) gui.controller = controller gui.load_settings() gtk.main()
def __init__(self): self._initDone = False self._connection = None self._osso = None self._deviceState = None self._clipboard = gtk.clipboard_get() self._credentials = ("", "") self._selectedBackendId = self.NULL_BACKEND self._defaultBackendId = self.GV_BACKEND self._phoneBackends = None self._dialpads = None self._accountViews = None self._messagesViews = None self._historyViews = None self._contactsViews = None self._alarmHandler = None self._ledHandler = None self._originalCurrentLabels = [] self._fsContactsPath = os.path.join(constants._data_path_, "contacts") for path in self._glade_files: if os.path.isfile(path): self._widgetTree = gtk.glade.XML(path) break else: display_error_message("Cannot find dialcentral.glade") gtk.main_quit() return self._window = self._widgetTree.get_widget("mainWindow") self._notebook = self._widgetTree.get_widget("notebook") errorBox = self._widgetTree.get_widget("errorEventBox") errorDescription = self._widgetTree.get_widget("errorDescription") errorClose = self._widgetTree.get_widget("errorClose") self._errorDisplay = gtk_toolbox.ErrorDisplay(errorBox, errorDescription, errorClose) self._credentialsDialog = gtk_toolbox.LoginWindow(self._widgetTree) self._smsEntryWindow = None self._isFullScreen = False self.__isPortrait = False self._app = hildonize.get_app_class()() self._window = hildonize.hildonize_window(self._app, self._window) hildonize.hildonize_text_entry(self._widgetTree.get_widget("usernameentry")) hildonize.hildonize_password_entry(self._widgetTree.get_widget("passwordentry")) for scrollingWidgetName in ( 'history_scrolledwindow', 'message_scrolledwindow', 'contacts_scrolledwindow', "smsMessages_scrolledwindow", ): scrollingWidget = self._widgetTree.get_widget(scrollingWidgetName) assert scrollingWidget is not None, scrollingWidgetName hildonize.hildonize_scrollwindow(scrollingWidget) for scrollingWidgetName in ( "smsMessage_scrolledEntry", ): scrollingWidget = self._widgetTree.get_widget(scrollingWidgetName) assert scrollingWidget is not None, scrollingWidgetName hildonize.hildonize_scrollwindow_with_viewport(scrollingWidget) for buttonName in ( "back", "addressbookSelectButton", "sendSmsButton", "dialButton", "callbackSelectButton", "minutesEntryButton", "clearcookies", "phoneTypeSelection", ): button = self._widgetTree.get_widget(buttonName) assert button is not None, buttonName hildonize.set_button_thumb_selectable(button) menu = hildonize.hildonize_menu( self._window, self._widgetTree.get_widget("dialpad_menubar"), ) if not hildonize.GTK_MENU_USED: button = gtk.Button("New Login") button.connect("clicked", self._on_clearcookies_clicked) menu.append(button) button = gtk.Button("Refresh") button.connect("clicked", self._on_menu_refresh) menu.append(button) menu.show_all() self._window.connect("key-press-event", self._on_key_press) self._window.connect("window-state-event", self._on_window_state_change) if not hildonize.IS_HILDON_SUPPORTED: _moduleLogger.warning("No hildonization support") hildonize.set_application_name("%s" % constants.__pretty_app_name__) self._window.connect("destroy", self._on_close) self._window.set_default_size(800, 300) self._window.show_all() self._loginSink = gtk_toolbox.threaded_stage( gtk_toolbox.comap( self._attempt_login, gtk_toolbox.null_sink(), ) ) if not PROFILE_STARTUP: backgroundSetup = threading.Thread(target=self._idle_setup) backgroundSetup.setDaemon(True) backgroundSetup.start() else: self._idle_setup()
logging.basicConfig(level=logging.DEBUG, format=logFormat) rotating = logging.handlers.RotatingFileHandler(constants._user_logpath_, maxBytes=512*1024, backupCount=1) rotating.setFormatter(logging.Formatter(logFormat)) root = logging.getLogger() root.addHandler(rotating) _moduleLogger.info("%s %s-%s" % (constants.__app_name__, constants.__version__, constants.__build__)) _moduleLogger.info("OS: %s" % (os.uname()[0], )) _moduleLogger.info("Kernel: %s (%s) for %s" % os.uname()[2:]) _moduleLogger.info("Hostname: %s" % os.uname()[1]) gobject.threads_init() gtk.gdk.threads_init() l = dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) # HACK Playback while silent on Maemo 5 hildonize.set_application_name("FMRadio") app = WatersOfShiloahProgram() if not PROFILE_STARTUP: try: gtk.main() except KeyboardInterrupt: app.quit() raise else: app.quit() if __name__ == "__main__": logging.basicConfig(level=logging.DEBUG) run()