def _load_applications(self): treestore = self.treeviewApplications.get_model() treestore.clear() self.added_applications = [] #self.interfacetype = 'text/xml' app_list = gio.app_info_get_default_for_type(self.interfacetype, False) row = self._load_application_group(_('Default application'), '', [app_list], treestore) app_list = gio.app_info_get_all_for_type(self.interfacetype) self._load_application_group(_('Recommended applications'), '', app_list, treestore) app_list = gio.app_info_get_all() self._load_application_group(_('Other applications'), '', app_list, treestore) self.treeviewApplications.set_model(treestore) #self.treeviewApplications.expand_all() try: self.treeviewApplications.expand_row((0,), False) except: pass
def _translate(self): description = _('Select an application to open') description = '<b>%s <<%s>></b>' % (description, self.interfacetype) self.set_title(_('Application selector')) self.lblDescription.set_markup(description) self.chkDefaultApplication.set_label(_('Check as default application for that interface type') + '.') self.btnSelect.set_label(_('Select')) self.btnCancel.set_label(_('Cancel'))
def notify(title, message, icon, timeout=pynotify.EXPIRES_DEFAULT, transient=True): # Desktop Notifications Specification: http://www.galago-project.org/specs/notification/0.9/index.html if not pynotify.init("HANS " + _("Notifications")): return notify = pynotify.Notification(title, message) notify.set_icon_from_pixbuf(icon) notify.set_category('device.added') notify.set_urgency(pynotify.URGENCY_LOW) notify.set_hint('transient', transient) notify.set_timeout(timeout) if not notify.show(): print "Failed to send notification"
def _init_treeview(self): tvcolumn = gtk.TreeViewColumn(_('Applications')) cell = gtk.CellRendererPixbuf() tvcolumn.pack_start(cell, False) tvcolumn.set_cell_data_func(cell, self._render_column_pixbuf) cell = gtk.CellRendererText() #tvcolumn.set_sort_column_id(0) tvcolumn.pack_start(cell, True) tvcolumn.set_cell_data_func(cell, self._render_column_text) self.treeviewApplications.append_column(tvcolumn) self.treeviewApplications.set_enable_search(True) self.treeviewApplications.set_search_column(0) self.treeviewApplications.set_show_expanders(True) treestore = gtk.TreeStore(object) self.treeviewApplications.set_model(treestore)
def finish_initializing(self, builder, device, execute_callback): """Called when we're finished initializing. finish_initalizing should be called after parsing the ui definition and creating a ActionSelectorSimple object with it in order to finish initializing the start of the new ActionSelectorSimple instance. """ self.iconviewInterfaces = builder.get_object('iconviewInterfaces') self.iconviewActions = builder.get_object('iconviewActions') self.lblTitle = builder.get_object('lblTitle') title = device.get_formated_name() title = '<big><big><b>%s</b></big></big>' % (title,) self.lblTitle.set_markup(title) self.set_title('HANS %s' % (_('Action selector'),)) # Get a reference to the builder and set up the signals. self.builder = builder self.device = device self.interface = None self._action_name_map = None self.builder.connect_signals(self) if type(execute_callback) == types.FunctionType or type(execute_callback) == types.MethodType: self.connect('execute-action', execute_callback) self._init_iconview(self.iconviewInterfaces) self._init_iconview(self.iconviewActions) self._load_interfaces() self.udev_signals = UdevSignals.UdevSignals() self.udev_signals.connect('added', self.on_device_added) self.udev_signals.connect('removed', self.on_device_removed) self.show()
def _get_text(self, entry): return '<b>' + _(entry.get_name()) + '</b>'