def __init__(self, db, category, search): self._db = db self._category = category self._search = search self._search.connect("hide", self._on_search_close) self.noteId = -1 self._pos = -1 self._noteBody = None #Last notetext self._categoryName = "" gtk.HBox.__init__(self, homogeneous = False, spacing = 0) _moduleLogger.info("libnotizen, init") # Note list self._noteslist = simple_list.SimpleList() self._noteslist.set_eventfunction_cursor_changed(self._update_noteslist) self._noteslist.widget.set_size_request(250, -1) buttonHBox = gtk.HBox() button = gtk.Button(stock = gtk.STOCK_ADD) button.connect("clicked", self._on_add_note, None) buttonHBox.pack_start(button, expand = True, fill = True, padding = 3) button = gtk.Button(stock = gtk.STOCK_DELETE) button.connect("clicked", self._on_delete_note, None) buttonHBox.pack_start(button, expand = True, fill = True, padding = 3) listVbox = gtk.VBox(homogeneous = False, spacing = 0) listVbox.pack_start(self._category, expand = False, fill = True, padding = 3) listVbox.pack_start(self._noteslist.widget, expand = True, fill = True, padding = 3) listVbox.pack_start(buttonHBox, expand = False, fill = True, padding = 3) self.pack_start(listVbox, expand = False, fill = True, padding = 3) # Note view self._noteBodyView = gtk.TextView() self._noteBodyView.connect("focus-out-event", self.save_note, "focus-out-event") buf = self._noteBodyView.get_buffer() buf.set_text("") buf.connect("changed", self._on_note_changed, None) if gtkspell is not None: self._noteBodySpellChecker = gtkspell.Spell(self._noteBodyView) else: self._noteBodySpellChecker = None self._noteScrollWindow = gtk.ScrolledWindow() self._noteScrollWindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self._noteScrollWindow.add(self._noteBodyView) hildonize.hildonize_scrollwindow_with_viewport(self._noteScrollWindow) # Note and history stuff in same column noteVbox = gtk.VBox(homogeneous = False, spacing = 0) noteVbox.pack_start(self._noteScrollWindow, expand = True, fill = True, padding = 3) self.pack_start(noteVbox, expand = True, fill = True, padding = 3) self.load_notes() self._category.connect("category_changed", self.load_notes) self._search.connect("search_changed", self.load_notes)
def __init__(self, db, liststorehandler, parent_window): self.db = db self.parent_window = parent_window self.liststorehandler = liststorehandler gtk.VBox.__init__(self, homogeneous = False, spacing = 0) logging.info("libview, init") self.treeview = None self.scrolled_window = gtk.ScrolledWindow() self.scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.pack_start(self.scrolled_window, expand = True, fill = True, padding = 0) self.scrolled_window = hildonize.hildonize_scrollwindow_with_viewport(self.scrolled_window) self.reload_view()
def __init__(self): self._unitDataInCategory = None self._unit_sort_direction = False self._value_sort_direction = False self._units_sort_direction = False self._isFullScreen = False self._find_result = [] # empty find result list self._findIndex = 0 # default to find result number zero self._selectedCategoryName = '' # preset to no selected category self._defaultUnitForCategory = {} # empty dictionary for later use #check to see if glade file is in current directory (user must be # running from download untar directory) for gladePath in self._glade_files: if os.path.isfile(gladePath): homepath = os.path.dirname(gladePath) pixmapspath = "/".join((homepath, "pixmaps")) widgets = gtk.glade.XML(gladePath) break else: _moduleLogger.error("UI Descriptor not found!") gtk.main_quit() return self._mainWindow = widgets.get_widget('mainWindow') self._app = hildonize.get_app_class()() self._mainWindow = hildonize.hildonize_window(self._app, self._mainWindow) change_menu_label(widgets, 'fileMenuItem', _('File')) change_menu_label(widgets, 'exitMenuItem', _('Exit')) change_menu_label(widgets, 'toolsMenuItem', _('Tools')) change_menu_label(widgets, 'clearSelectionMenuItem', _('Clear selections')) change_menu_label(widgets, 'helpMenuItem', _('Help')) change_menu_label(widgets, 'aboutMenuItem', _('About')) change_menu_label(widgets, 'findButton', _('Find')) self._shortlistcheck = widgets.get_widget('shortlistcheck') self._toggleShortList = widgets.get_widget('toggleShortList') self._categorySelectionButton = widgets.get_widget("categorySelectionButton") self._categoryView = widgets.get_widget('categoryView') self._unitsView = widgets.get_widget('unitsView') self._unitsView.set_property('rules_hint', 1) self._unitsView_selection = self._unitsView.get_selection() self._unitName = widgets.get_widget('unitName') self._unitValue = widgets.get_widget('unitValue') self._previousUnitName = widgets.get_widget('previousUnitName') self._previousUnitValue = widgets.get_widget('previousUnitValue') self._unitSymbol = widgets.get_widget('unitSymbol') self._previousUnitSymbol = widgets.get_widget('previousUnitSymbol') self._unitDescription = widgets.get_widget('unitDescription') self._searchLayout = widgets.get_widget('searchLayout') self._searchLayout.hide() self._findEntry = widgets.get_widget('findEntry') self._findLabel = widgets.get_widget('findLabel') self._findButton = widgets.get_widget('findButton') #insert a self._categoryColumnumn into the units list even though the heading will not be seen renderer = gtk.CellRendererText() renderer.set_property("ellipsize", pango.ELLIPSIZE_END) renderer.set_property("width-chars", len("grams per cubic cm plus some")) hildonize.set_cell_thumb_selectable(renderer) self._unitNameColumn = gtk.TreeViewColumn(_('Name'), renderer) self._unitNameColumn.set_property('resizable', 1) self._unitNameColumn.add_attribute(renderer, 'text', self.UNITS_NAME_IDX) self._unitNameColumn.set_clickable(True) self._unitNameColumn.connect("clicked", self._on_click_unit_column) self._unitsView.append_column(self._unitNameColumn) renderer = gtk.CellRendererText() hildonize.set_cell_thumb_selectable(renderer) self._unitValueColumn = gtk.TreeViewColumn(_('Value'), renderer) self._unitValueColumn.set_property('resizable', 1) self._unitValueColumn.add_attribute(renderer, 'text', self.UNITS_VALUE_IDX) self._unitValueColumn.set_clickable(True) self._unitValueColumn.connect("clicked", self._on_click_unit_column) self._unitsView.append_column(self._unitValueColumn) renderer = gtk.CellRendererText() renderer.set_property("ellipsize", pango.ELLIPSIZE_END) renderer.set_property("width-chars", len("G ohm plus some")) hildonize.set_cell_thumb_selectable(renderer) self._unitSymbolColumn = gtk.TreeViewColumn(_('Units'), renderer) self._unitSymbolColumn.set_property('resizable', 1) self._unitSymbolColumn.add_attribute(renderer, 'text', self.UNITS_SYMBOL_IDX) self._unitSymbolColumn.set_clickable(True) self._unitSymbolColumn.connect("clicked", self._on_click_unit_column) self._unitsView.append_column(self._unitSymbolColumn) self._unitModel = gtk.ListStore( gobject.TYPE_STRING, # UNITS_NAME_IDX gobject.TYPE_STRING, # UNITS_VALUE_IDX gobject.TYPE_STRING, # UNITS_SYMBOL_IDX ) self._sortedUnitModel = gtk.TreeModelSort(self._unitModel) columns = self._get_column_sort_stuff() for columnIndex, (column, sortDirection, col_cmp) in enumerate(columns): self._sortedUnitModel.set_sort_func(columnIndex, col_cmp) self._unitsView.set_model(self._sortedUnitModel) #Insert a column into the category list even though the heading will not be seen renderer = gtk.CellRendererText() self._categoryColumn = gtk.TreeViewColumn('Title', renderer) self._categoryColumn.set_property('resizable', 1) self._categoryColumn.add_attribute(renderer, 'text', 0) self._categoryView.append_column(self._categoryColumn) self._categoryModel = gtk.ListStore(gobject.TYPE_STRING) self._categoryView.set_model(self._categoryModel) #colourize each row differently for easier reading self._categoryView.set_property('rules_hint', 1) #Populate the catagories list for key in unit_data.UNIT_CATEGORIES: row = (key, ) self._categoryModel.append(row) #--------- connections to GUI ---------------- dic = { "on_exit_menu_activate": self._on_user_exit, "on_categoryView_select_row": self._on_click_category, "on_unitValue_changed": self._on_unit_value_changed, "on_previousUnitValue_changed": self._on_previous_unit_value_changed, "on_findButton_clicked": self._on_find_activate, "on_findEntry_activated": self._on_find_activate, "on_findEntry_changed": self._on_findEntry_changed, "on_aboutMenuItem_activate": self._on_about_clicked, "on_clearSelectionMenuItem_activate": self._on_user_clear_selections, "on_unitsView_cursor_changed": self._on_click_unit, "on_shortlistcheck_toggled": self._on_shortlist_changed, "on_toggleShortList_activate": self._on_edit_shortlist, } widgets.signal_autoconnect(dic) self._mainWindow.connect("delete-event", self._on_user_exit) self._mainWindow.connect("key-press-event", self._on_key_press) self._mainWindow.connect("window-state-event", self._on_window_state_change) self._categorySelectionButton.connect("clicked", self._on_category_selector_clicked) for scrollingWidgetName in ( "unitsViewScrolledWindow", ): scrollingWidget = widgets.get_widget(scrollingWidgetName) assert scrollingWidget is not None, scrollingWidgetName hildonize.hildonize_scrollwindow_with_viewport(scrollingWidget) if hildonize.IS_HILDON_SUPPORTED or FORCE_HILDON_LIKE: self._categoryView.get_parent().hide() self._unitsView.set_headers_visible(False) self._previousUnitName.get_parent().hide() self._unitDescription.get_parent().get_parent().hide() else: self._categorySelectionButton.hide() replacementButtons = [] menu = hildonize.hildonize_menu( self._mainWindow, widgets.get_widget("mainMenuBar"), replacementButtons ) if not hildonize.IS_HILDON_SUPPORTED: _moduleLogger.info("No hildonization support") hildonize.set_application_title( self._mainWindow, "%s - Unit Conversion Utility" % constants.__pretty_app_name__ ) iconPath = pixmapspath + '/gonvert.png' if os.path.exists(iconPath): self._mainWindow.set_icon(gtk.gdk.pixbuf_new_from_file(iconPath)) else: _moduleLogger.warn("Error: Could not find gonvert icon: %s" % iconPath) self._load_settings() self._mainWindow.show()
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()
def __init__(self, db, category, search): self._db = db self._category = category self._search = search self._search.connect("hide", self._on_search_close) self.noteId = -1 self._pos = -1 self._noteBody = None #Last notetext self._categoryName = "" gtk.HBox.__init__(self, homogeneous=False, spacing=0) _moduleLogger.info("libnotizen, init") # Note list self._noteslist = simple_list.SimpleList() self._noteslist.set_eventfunction_cursor_changed( self._update_noteslist) self._noteslist.widget.set_size_request(250, -1) buttonHBox = gtk.HBox() button = gtk.Button(stock=gtk.STOCK_ADD) button.connect("clicked", self._on_add_note, None) buttonHBox.pack_start(button, expand=True, fill=True, padding=3) button = gtk.Button(stock=gtk.STOCK_DELETE) button.connect("clicked", self._on_delete_note, None) buttonHBox.pack_start(button, expand=True, fill=True, padding=3) listVbox = gtk.VBox(homogeneous=False, spacing=0) listVbox.pack_start(self._category, expand=False, fill=True, padding=3) listVbox.pack_start(self._noteslist.widget, expand=True, fill=True, padding=3) listVbox.pack_start(buttonHBox, expand=False, fill=True, padding=3) self.pack_start(listVbox, expand=False, fill=True, padding=3) # Note view self._noteBodyView = gtk.TextView() self._noteBodyView.connect("focus-out-event", self.save_note, "focus-out-event") buf = self._noteBodyView.get_buffer() buf.set_text("") buf.connect("changed", self._on_note_changed, None) if gtkspell is not None: self._noteBodySpellChecker = gtkspell.Spell(self._noteBodyView) else: self._noteBodySpellChecker = None self._noteScrollWindow = gtk.ScrolledWindow() self._noteScrollWindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self._noteScrollWindow.add(self._noteBodyView) hildonize.hildonize_scrollwindow_with_viewport(self._noteScrollWindow) # Note and history stuff in same column noteVbox = gtk.VBox(homogeneous=False, spacing=0) noteVbox.pack_start(self._noteScrollWindow, expand=True, fill=True, padding=3) self.pack_start(noteVbox, expand=True, fill=True, padding=3) self.load_notes() self._category.connect("category_changed", self.load_notes) self._search.connect("search_changed", self.load_notes)