def show_statistics(self, widget): widget.set_sensitive(False) title = _('Tasker') subtitle = _('Tasks statistics') configuration = Configuration() preferences = self.configuration.get('preferences') mc = CURRENCIES[self.main_currency] currencies = [] for i in range(0, 5): currencies.append(CURRENCIES[self.currencies[i]]) days = [] c0 = [] c1 = [] c2 = [] c3 = [] c4 = [] for aday in self.exchange.data: days.append(aday['date']) mc = aday[self.main_currency.lower()] c0.append(round(aday[self.currencies[0].lower()] / mc)) c1.append(round(aday[self.currencies[1].lower()] / mc)) c2.append(round(aday[self.currencies[2].lower()] / mc)) c3.append(round(aday[self.currencies[3].lower()] / mc)) c4.append(round(aday[self.currencies[4].lower()] / mc)) graph = Graph(title, subtitle, currencies, days, c0, c1, c2, c3, c4) graph.run() graph.destroy() widget.set_sensitive(True)
def convert(self): src = self.target target = src.replace(self.codec, ".mp3") if os.path.exists(target): os.remove(target) if sys.platform != "linux2": ffmpeg_path = os.path.join( os.path.dirname(os.path.dirname(config.exec_path)), "ffmpeg\\ffmpeg.exe" ).replace("\\", "\\\\") target = target.replace("\\", "\\\\") src = src.replace("\\", "\\\\") else: ffmpeg_path = "/usr/bin/ffmpeg" self.print_info(_("Extracting audio...")) try: self.gui.throbber.show() (pid, t, r, s) = gobject.spawn_async( [str(ffmpeg_path), "-i", str(src), "-f", "mp3", "-ab", "192k", str(target)], flags=gobject.SPAWN_DO_NOT_REAP_CHILD, standard_output=True, standard_error=True, ) gobject.child_watch_add(pid, self.task_done) except: self.print_info(_("Extraction failed...")) sleep(4) self.print_info("") self.gui.throbber.hide()
def run(self): self.create_download_box() while not self._stopevent.isSet(): ## download... self.gui.download_treestore.set_value(self.treeiter, 2, _("Starting download...")) try: self.start_time = time.time() self.check_target_file(self.temp_file) self.download(self.url, self.temp_file) if self.failed: self.gui.download_treestore.set_value(self.treeiter, 2, _("Download error...")) self.download_finished() elif self.canceled: self.gui.download_treestore.set_value(self.treeiter, 2, _("Download canceled...")) self.gui.download_treestore.set_value(self.treeiter, 8, "") self.download_finished() ## already downloaded elif self.completed: self.gui.download_treestore.set_value(self.treeiter, 2, _("Download complete...")) self.gui.download_treestore.set_value(self.treeiter, 1, 100) if self.engine_type == "video": self.gui.download_treestore.set_value(self.treeiter, 9, "gtk-convert") self.download_finished() else: continue except: print "failed" self.failed = True self.gui.download_treestore.set_value(self.treeiter, 2, _("Download error...")) self.download_finished()
def init_ui(self): BaseDialog.init_ui(self) label = Gtk.Label.new(_("Tag name:")) label.set_property("halign", Gtk.Align.START) self.grid.attach(label, 0, 0, 1, 1) self.text = Gtk.Entry.new() self.grid.attach(self.text, 1, 0, 1, 1) label = Gtk.Label.new(_("Type:")) label.set_property("halign", Gtk.Align.START) self.grid.attach(label, 0, 1, 1, 1) type_store = Gtk.ListStore(str, str) type_store.append([_("Boolean"), "boolean"]) type_store.append([_("Date"), "date"]) type_store.append([_("String"), "string"]) self.type = Gtk.ComboBox.new() self.type.set_model(type_store) cell1 = Gtk.CellRendererText() self.type.pack_start(cell1, True) self.type.add_attribute(cell1, "text", 0) self.grid.attach(self.type, 1, 1, 1, 1)
def on_metacity_delbtn_clicked(self,widget): confirm = yesno((_("Remove metacity theme")),(_("Are you sure you want to delete the metacity Theme \n%s ?") % self.metacity_thname)) if confirm == "No": return self.metacity_dict.del_item(self.metacity_thname) self.model.remove(self.iter) self.statbar.push(1,(_("metacity theme %s removed successfully") % self.metacity_thname))
def init_ui(self): BaseDialog.init_ui(self) self.contributors = ListBoxContributors() self.contributors.set_size_request(300, 500) self.grid.attach(self.contributors, 0, 0, 1, 1) box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 5) self.grid.attach(box, 1, 0, 1, 2) button_add = Gtk.Button.new_with_label(_('Add contributor')) button_add.connect('clicked', self.on_button_add_clicked) box.add(button_add) button_edit = Gtk.Button.new_with_label(_('Edit contributor')) button_edit.connect('clicked', self.on_button_edit_clicked) box.add(button_edit) button_remove = Gtk.Button.new_with_label(_('Remove contributor')) button_remove.connect('clicked', self.on_button_remove_clicked) box.add(button_remove) button_clear = Gtk.Button.new_with_label(_('Clear contributor')) button_clear.connect('clicked', self.on_button_clear_clicked) box.add(button_clear)
def _build_keybinding(self, ): page_keybinding = self._new_page('Keybinding') label_new_task = Gtk.Label.new(_('New task')) label_new_task.set_property('halign', Gtk.Align.START) label_show_tasks = Gtk.Label.new(_('Show tasks')) label_show_tasks.set_property('halign', Gtk.Align.START) page_keybinding.attach(label_new_task, 0, 0, 1, 1) page_keybinding.attach(label_show_tasks, 0, 1, 1, 1) self.new_task_keybinding = Gtk.Entry.new() self.new_task_keybinding.set_property("editable", False) self.new_task_keybinding.set_property("can_focus", False) self.new_task_keybinding.set_property('halign', Gtk.Align.CENTER) self.new_task_keybinding.connect('button-press-event', self.on_new_task_keybinding) self.show_tasks_keybinding = Gtk.Entry.new() self.show_tasks_keybinding.set_property("editable", False) self.show_tasks_keybinding.set_property("can_focus", False) self.show_tasks_keybinding.set_property('halign', Gtk.Align.CENTER) self.show_tasks_keybinding.connect('button-press-event', self.on_show_task_keybinding) page_keybinding.attach(self.new_task_keybinding, 1, 0, 1, 1) page_keybinding.attach(self.show_tasks_keybinding, 1, 1, 1, 1)
def get_model(self,widget=None): """Action to get the information theme emerald""" selected = self.emerald_iconview.get_selected_items() ## check if path exist (or problems when clicking between rows..) try: row_index = selected[0] except: return ## else extract needed emerald's infos self.iter = self.model.get_iter(row_index) self.emerald_thname = self.model.get_value(self.iter, 0) ## return only theme name and description ## then extract infos from hash self.emerald_thdir = self.model.get_value(self.iter, 2) self.emerald_creator = self.model.get_value(self.iter, 3) self.emerald_description = self.model.get_value(self.iter, 4) self.emerald_theme_version = self.model.get_value(self.iter, 5) self.emerald_suggested = self.model.get_value(self.iter, 6) self.emerald_version = self.model.get_value(self.iter, 7) # print in the gui self.emerald_gest_info.set_text(_('Author : %(author)s \n\ Version : %(version)s \n\ Suggested gtk/Qt theme : %(suggested)s \n\ Description : %(description)s') % {"author":self.emerald_creator, "version":self.emerald_theme_version, "suggested":self.emerald_suggested, "description":self.emerald_description }) self.statbar.push(1,(_("Selected emerald theme : %s") % self.emerald_thname))
def show_statistics(self, widget): widget.set_sensitive(False) if self.is_monitoring and self.monitor is not None: self.monitor.save() title = _('Habits') subtitle = _('Mouse and keyboard') configuration = Configuration() stats = configuration.get('stats') days = [] distance = [] clics = [] keys = [] for day in stats: days.append(day) if 'distance' in stats[day].keys(): distance.append(stats[day]['distance']/1000.0) else: distance.append(0) if 'clics' in stats[day].keys(): clics.append(stats[day]['clics']) else: clics.append(0) if 'keys' in stats[day].keys(): keys.append(stats[day]['keys']) else: keys.append(0) graph = Graph(title, subtitle, days, distance, clics, keys) graph.run() graph.destroy() widget.set_sensitive(True)
def build_menu(self): menu = Gtk.Menu() self.menu_toggle_service = Gtk.MenuItem.new_with_label( _('Start service')) self.menu_toggle_service.connect('activate', self.toggle_service) menu.append(self.menu_toggle_service) menu.append(Gtk.SeparatorMenuItem()) menu_send_message = Gtk.MenuItem.new_with_label( _('Send message')) menu_send_message.connect('activate', self.on_send_message) menu.append(menu_send_message) menu.append(Gtk.SeparatorMenuItem()) menu_preferences = Gtk.MenuItem.new_with_label(_('Preferences')) menu_preferences.connect('activate', self.show_preferences) menu.append(menu_preferences) menus_help = Gtk.MenuItem.new_with_label(_('Help')) menus_help.set_submenu(self.get_help_menu()) menu.append(menus_help) menu.append(Gtk.SeparatorMenuItem()) menu_quit = Gtk.MenuItem. new_with_label(_('Quit')) menu_quit.connect('activate', self.quit) menu.append(menu_quit) menu.show_all() return menu
def _build_page_general(self): page01 = self._new_page('General') label = Gtk.Label.new(_('Theme light:')) label.set_property('halign', Gtk.Align.START) page01.attach(label, 0, 0, 1, 1) self.theme_light = Gtk.Switch.new() self.theme_light.set_property('halign', Gtk.Align.CENTER) page01.attach(self.theme_light, 1, 0, 1, 1) label = Gtk.Label.new(_('Autostart')) label.set_property('halign', Gtk.Align.START) page01.attach(label, 0, 1, 1, 1) self.autostart = Gtk.Switch.new() self.autostart.set_property('halign', Gtk.Align.CENTER) page01.attach(self.autostart, 1, 1, 1, 1) page01.attach(Gtk.Separator(), 0, 2, 2, 1) label = Gtk.Label.new(_('Number of tasks in menu:')) label.set_property('halign', Gtk.Align.START) page01.attach(label, 0, 3, 1, 1) self.todos = Gtk.SpinButton.new_with_range(1, 20, 1) page01.attach(self.todos, 1, 3, 1, 1) page01.attach(Gtk.Separator(), 0, 4, 2, 1) label = Gtk.Label.new(_('Todo file:')) label.set_property('halign', Gtk.Align.START) page01.attach(label, 0, 5, 1, 1) todofilter = Gtk.FileFilter.new() todofilter.add_pattern('*.txt') todofilter.add_mime_type('text/plain') self.todo_file = Gtk.FileChooserButton.new(_('Todo file'), Gtk.FileChooserAction.OPEN) self.todo_file.add_filter(todofilter) page01.attach(self.todo_file, 1, 5, 1, 1)
def on_paste(self,widget=None,url=None): text = '' if not url: clipboard = gtk.Clipboard(gtk.gdk.display_get_default(), "CLIPBOARD") data = clipboard.wait_for_contents('UTF8_STRING') try: text = data.get_text() except: error_dialog(_("There's no link to paste...")) return else: text = url if text != '': vid=None try: vid = re.search('watch\?v=(.*?)&(.*)',text).group(1) except: try: vid = re.search('watch\?v=(.*)',text).group(1) except: error_dialog(_('Your link:\n\n%s\n\nis not a valid youtube link...' % text)) return yt = yt_service.YouTubeService() entry = yt.GetYouTubeVideoEntry(video_id='%s' % vid) self.filter(entry, '', 1) else: return
def start(self): configuration = Configuration() preferences = configuration.get('preferences') https_protocol = preferences['https_protocol'] base_url = preferences['base_url'] application_name = preferences['application_name'] application_token = preferences['application_token'] client_token = preferences['client_token'] if base_url and application_name and application_token \ and client_token: self.gotify_client = GotifyClient(https_protocol, base_url, application_name, application_token, client_token, self.on_message, True) self.gotify_client.set_icon_callback(self.set_icon) self.gotify_client.start() self.menu_toggle_service.set_label(_('Stop service')) return True message = _('Please configure Gotify Indicator') icon = os.path.join(config.ICONDIR, 'gotify-indicator.svg') self.notification.update('Gofify-Indictator', message, icon) self.notification.show()
def init_headbar(self): hb = Gtk.HeaderBar() hb.set_show_close_button(True) hb.set_title(self.get_title()) self.set_titlebar(hb) button1 = Gtk.Button() button1.set_size_request(40, 40) button1.set_tooltip_text(_('Update')) button1.connect('clicked', self.on_button_update_clicked) button1.set_image( Gtk.Image.new_from_gicon( Gio.ThemedIcon(name='preferences-system-symbolic'), Gtk.IconSize.BUTTON)) hb.pack_start(button1) self.popover = self.create_popover() button4 = Gtk.MenuButton() button4.set_size_request(40, 40) button4.set_tooltip_text(_('Options')) button4.set_popover(self.popover) button4.set_image( Gtk.Image.new_from_gicon(Gio.ThemedIcon(name='pan-down-symbolic'), Gtk.IconSize.BUTTON)) hb.pack_end(button4)
def get_model(self, widget=None): """Action to get the information theme emerald""" selected = self.emerald_iconview.get_selected_items() ## check if path exist (or problems when clicking between rows..) try: row_index = selected[0] except: return ## else extract needed emerald's infos self.iter = self.model.get_iter(row_index) self.emerald_thname = self.model.get_value(self.iter, 0) ## return only theme name and description ## then extract infos from hash self.emerald_thdir = self.model.get_value(self.iter, 2) self.emerald_creator = self.model.get_value(self.iter, 3) self.emerald_description = self.model.get_value(self.iter, 4) self.emerald_theme_version = self.model.get_value(self.iter, 5) self.emerald_suggested = self.model.get_value(self.iter, 6) self.emerald_version = self.model.get_value(self.iter, 7) # print in the gui self.emerald_gest_info.set_text( _('Author : %(author)s \n\ Version : %(version)s \n\ Suggested gtk/Qt theme : %(suggested)s \n\ Description : %(description)s') % { "author": self.emerald_creator, "version": self.emerald_theme_version, "suggested": self.emerald_suggested, "description": self.emerald_description }) self.statbar.push( 1, (_("Selected emerald theme : %s") % self.emerald_thname))
def _build_behaviors(self, ): page05 = self._new_page("Behaviors") label = Gtk.Label.new(_("Hide completed tasks")) label.set_property("halign", Gtk.Align.START) page05.attach(label, 0, 0, 1, 1) self.hide_completed = Gtk.Switch.new() self.hide_completed.set_property("halign", Gtk.Align.CENTER) page05.attach(self.hide_completed, 1, 0, 1, 1) label = Gtk.Label.new(_("Filter by projects")) label.set_property("halign", Gtk.Align.START) page05.attach(label, 0, 1, 1, 1) self.filter_projects = Gtk.Switch.new() self.filter_projects.set_property("halign", Gtk.Align.CENTER) page05.attach(self.filter_projects, 1, 1, 1, 1) label = Gtk.Label.new(_("Filter by contexts")) label.set_property("halign", Gtk.Align.START) page05.attach(label, 0, 2, 1, 1) self.filter_contexts = Gtk.Switch.new() self.filter_contexts.set_property("halign", Gtk.Align.CENTER) page05.attach(self.filter_contexts, 1, 2, 1, 1) label = Gtk.Label.new(_("Show hidden tags")) label.set_property("halign", Gtk.Align.START) page05.attach(label, 0, 3, 1, 1) self.show_hidden_tags = Gtk.Switch.new() self.show_hidden_tags.set_property("halign", Gtk.Align.CENTER) page05.attach(self.show_hidden_tags, 1, 3, 1, 1)
def init_ui(self): BaseDialog.init_ui(self) label = Gtk.Label.new(_('Tag name:')) label.set_property('halign', Gtk.Align.START) self.grid.attach(label, 0, 0, 1, 1) self.text = Gtk.Entry.new() self.grid.attach(self.text, 1, 0, 1, 1) label = Gtk.Label.new(_('Type:')) label.set_property('halign', Gtk.Align.START) self.grid.attach(label, 0, 1, 1, 1) type_store = Gtk.ListStore(str, str) type_store.append([_('Boolean'), 'boolean']) type_store.append([_('Date'), 'date']) type_store.append([_('String'), 'string']) self.type = Gtk.ComboBox.new() self.type.set_model(type_store) cell1 = Gtk.CellRendererText() self.type.pack_start(cell1, True) self.type.add_attribute(cell1, 'text', 0) self.grid.attach(self.type, 1, 1, 1, 1)
def action_del(self,widget): confirm = yesno((_("Remove cubemodels themes")),\ (_("Are you sure you want to delete the cubemodels Theme \n %s ?") % self.item_name)) if confirm == "No": return self.cubemodels_dict.del_item(self.item_name) self.statbar.push(1,_("Cubemodel theme %s successfully removed" % self.item_name)) self.model.remove(self.iter)
def on_emerald_delbtn_clicked(self,widget): confirm = yesno((_("Remove emerald theme")),(_("Are you sure you want to delete the Emerald Theme \n%s ?") % self.emerald_thname)) if confirm == "No": return print self.emerald_dict.del_item(self.emerald_thname) self.model.remove(self.iter) self.statbar.push(1,(_("Emerald theme %s removed successfully") % self.emerald_thname))
def action_del(self,widget): confirm = yesno((_("Remove mouse themes")),\ _("Are you sure you want to delete the mouse Theme \n %s ?") % self.item_name) if confirm == "No": return ## remove the theme self.mouse_dict.del_item(self.item_dirname) self.model.remove(self.iter) self.statbar.push(1,_("Mouse theme %s removed successfully") % self.item_name)
def action_del(self, widget): confirm = yesno((_("Remove fullpack themes")),\ (_("Are you sure you want to delete the fullpack Theme \n %s ?") % self.item_name)) if confirm == "No": return self.fullpack_dict.del_item(self.item_name) self.statbar.push( 1, _("Fullpack theme %s successfully removed" % self.item_name)) self.model.remove(self.iter)
def set_filter_context_label(self): contexts_items = self.menu_filter_contexts.get_submenu().get_children() contexts_items_actives = self.get_context_showed() contexts_sel = _("All") if len(contexts_items) != len(contexts_items_actives): contexts_sel = ", ".join(contexts_items_actives) if contexts_sel == "": contexts_sel = _("Select one to show tasks") self.menu_filter_contexts.set_label(contexts_sel)
def set_filter_project_label(self): projects_items = self.menu_filter_projects.get_submenu().get_children() projects_items_actives = self.get_project_showed() projects_sel = _('All') if len(projects_items) != len(projects_items_actives): projects_sel = ', '.join(projects_items_actives) if projects_sel == '': projects_sel = _('Select one to show tasks') self.menu_filter_projects.set_label(projects_sel)
def set_filter_project_label(self): projects_items = self.menu_filter_projects.get_submenu().get_children() projects_items_actives = self.get_project_showed() projects_sel = _("All") if len(projects_items) != len(projects_items_actives): projects_sel = ", ".join(projects_items_actives) if projects_sel == "": projects_sel = _("Select one to show tasks") self.menu_filter_projects.set_label(projects_sel)
def __init__(self, title='', subtitle=''): self.title = _(title) self.configuration = Configuration() preferences = self.configuration.get('preferences') todo_file = Path(os.path.expanduser(preferences['todo-file'])) self.todo_file = todo_file.as_posix() self.subtitle = _(subtitle) BaseDialog.__init__(self, title, None, ok_button=False, cancel_button=False)
def __init__(self, title, source_code=False): """TODO: to be defined. """ Gtk.Grid.__init__(self) self.set_row_spacing(10) self.set_column_spacing(10) self.set_margin_bottom(10) self.set_margin_start(10) self.set_margin_end(10) self.set_margin_top(10) label = Gtk.Label.new(title) label.set_halign(Gtk.Align.START) label.set_margin_end(10) self.attach(label, 0, 0, 2, 1) scrollbar = Gtk.ScrolledWindow.new(None, None) scrollbar.set_shadow_type(Gtk.ShadowType.ETCHED_OUT) scrollbar.set_size_request(800, 150) self.attach(scrollbar, 0, 1, 2, 1) self.content = Gtk.TextView.new() self.content.set_margin_bottom(10) self.content.set_margin_start(10) self.content.set_margin_end(10) self.content.set_margin_top(10) if source_code: font_desc = Pango.FontDescription.from_string('monospace') if font_desc: self.content.modify_font(font_desc) scrollbar.add(self.content) self.attach(Gtk.Separator(), 0, 2, 2, 1) self.contributors = ListBoxContributors() self.contributors.set_size_request(500, 150) self.attach(self.contributors, 0, 3, 1, 1) box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 5) self.attach(box, 1, 3, 1, 1) button_add = Gtk.Button.new_with_label(_('Add contributor')) button_add.connect('clicked', self.on_button_add_clicked) box.add(button_add) button_edit = Gtk.Button.new_with_label(_('Edit contributor')) button_edit.connect('clicked', self.on_button_edit_clicked) box.add(button_edit) button_remove = Gtk.Button.new_with_label(_('Remove contributor')) button_remove.connect('clicked', self.on_button_remove_clicked) box.add(button_remove) button_clear = Gtk.Button.new_with_label(_('Clear contributors')) button_clear.connect('clicked', self.on_button_clear_clicked) box.add(button_clear)
def on_button_add_clicked(self, widget): addTodoDialog = AddTodoDialog(_('Add task')) if addTodoDialog.run() == Gtk.ResponseType.ACCEPT: todo = addTodoDialog.get_task() if not todo: Alert.show_alert(_('Fill your task'), _('You must specify a text for the task')) else: self.todos.add_item(todo) addTodoDialog.destroy()
def __init__(self, gladexml, emerald_dict): ## load buttons and attach signals self.emerald_dict = emerald_dict self.emerald_addbtn = gladexml.get_widget("emerald_addbtn") self.emerald_applybtn = gladexml.get_widget("emerald_applybtn") self.emerald_delbtn = gladexml.get_widget("emerald_delbtn") self.statbar = gladexml.get_widget("statusbar") dic = { "on_emerald_addbtn_clicked": self.on_emerald_addbtn_clicked, "on_emerald_applybtn_clicked": self.apply_emerald_theme, "on_emerald_delbtn_clicked": self.on_emerald_delbtn_clicked, } gladexml.signal_autoconnect(dic) ## for threads self.progress_box = gladexml.get_widget("progress_box") self.progress_text = gladexml.get_widget("progress_box_text") self.main_progressbar = gladexml.get_widget("main_progressbar") ## setup the liststore model self.model = gtk.ListStore(str, gtk.gdk.Pixbuf, str, str, str, str, str, str) ## setup the iconview self.emerald_iconview = gtk.IconView(model=self.model) self.emerald_iconview.set_pixbuf_column(1) self.emerald_iconview.set_text_column(0) self.emerald_iconview.set_item_width(225) self.emerald_iconview.set_selection_mode('single') self.emerald_iconview.set_reorderable(1) ## iconview signal self.emerald_iconview.connect('selection_changed', self.get_model) self.emerald_iconview.connect('button-press-event', self.check_double_click) self.emerald_gest_info = gladexml.get_widget("emerald_gest_info") self.emerald_gest_viewer = gladexml.get_widget("emerald_gest_viewer") self.emerald_dret_label = gladexml.get_widget("emerald_dret_label") self.emerald_applybtn = gladexml.get_widget("emerald_applybtn") self.emerald_addbtn = gladexml.get_widget("emerald_addbtn") self.emerald_delbtn = gladexml.get_widget("emerald_delbtn") self.decoration_page_img = gladexml.get_widget("decoration_page_img") self.decoration_page_desc = gladexml.get_widget("decoration_page_desc") self.decoration_page_img.set_from_file(config.img_path + "//decoration.png") self.decoration_page_desc.set_text( _("Window decoration :\nManage and install your metacity/emerald themes" )) self.emerald_gest_info.set_text(_("Available themes list")) ## add the iconview self.emerald_gest_viewer.add(self.emerald_iconview) self.list_emerald_themes()
def install_dialog(theme_list, archive): ## glade dialog dialog_gui = gtk.glade.XML(INSTALL_GLADE, None, APP_NAME) install_dialog = dialog_gui.get_widget("install_dialog") install_dialog.set_title(_("Scan results")) install_dialog.set_position("center") install_label = dialog_gui.get_widget("install_dialog_label") install_label.set_text( _("Scan report for : \n\ %s \n\n The followings themes are ready to install !") % archive) ## gtk if theme_list.has_key('gtk'): gtk_label = dialog_gui.get_widget("gtk_label") gtk_label.set_text('\n'.join(theme_list['gtk'])) ## icons if theme_list.has_key('icons'): icons_label = dialog_gui.get_widget("icons_label") icons_label.set_text('\n'.join(theme_list['icons'])) ## metacity if theme_list.has_key('metacity'): metacity_label = dialog_gui.get_widget("metacity_label") metacity_label.set_text('\n'.join(theme_list['metacity'])) ## cursors if theme_list.has_key('mouse'): cursors_label = dialog_gui.get_widget("cursors_label") cursors_label.set_text('\n'.join(theme_list['mouse'])) ## emerald if theme_list.has_key('emerald'): emerald_label = dialog_gui.get_widget("emerald_label") emerald_label.set_text('\n'.join(theme_list['emerald'])) ## cubemodel if theme_list.has_key('cubemodels'): cubemodels_label = dialog_gui.get_widget("cubemodels_label") cubemodels_label.set_text('\n'.join(theme_list['cubemodels'])) ## wallpaper if theme_list.has_key('wallstats'): wallpapers_label = dialog_gui.get_widget("wallpapers_label") wallpapers_label.set_text('\n'.join(theme_list['wallstats'])) ## walltimes if theme_list.has_key('walltimes'): wallpapers_label = dialog_gui.get_widget("walltimes_label") wallpapers_label.set_text('\n'.join(theme_list['walltimes'])) ## fullpack if theme_list.has_key('fullpacks'): fullpack_label = dialog_gui.get_widget("fullpacks_label") fullpack_label.set_text('\n'.join(theme_list['fullpacks'])) install_result = install_dialog.run() install_dialog.destroy() ## get glade return code if install_result == 0: return True else: return False
def action_delete(self,widget): confirm = yesno((_("Remove Gtk themes")),\ (_("Are you sure you want to delete the gtk Theme \n %s ?") % self.item.dirname)) if confirm == "No": return ## remove the theme self.gtk_dict.action_delete(self.item.dirname) model = self.gtkThemes_selector.get_model() model.clear() self.list_gtk_themes() self.statbar.push(1,(_("Gtk theme %s removed successfully") % self.item.name))
def on_metacity_delbtn_clicked(self, widget): confirm = yesno( (_("Remove metacity theme")), (_("Are you sure you want to delete the metacity Theme \n%s ?") % self.metacity_thname)) if confirm == "No": return self.metacity_dict.del_item(self.metacity_thname) self.model.remove(self.iter) self.statbar.push(1, (_("metacity theme %s removed successfully") % self.metacity_thname))
def build_menu(self): menu = Gtk.Menu() menu.connect('draw', self.on_popped) if self.filter_projects: self.menu_filter_projects = Gtk.CheckMenuItem.new_with_label('') self.menu_filter_projects.set_submenu( self.get_filter_project_menu()) self.set_filter_project_label() menu.append(self.menu_filter_projects) menu.append(Gtk.SeparatorMenuItem()) self.menu_todos = [] for i in range(0, self.todos): menuitem = Gtk.CheckMenuItem.new_with_label('') menuitem.remove(menuitem.get_child()) menuitem.add(Gtk.Label.new('')) menuitem.get_child().set_use_markup(True) self.menu_todos.append(menuitem) menu.append(self.menu_todos[i]) menu.append(Gtk.SeparatorMenuItem()) menu_add_todo = Gtk.MenuItem.new_with_label(_('Add task')) menu_add_todo.connect('activate', self.on_menu_add_todo_activate) menu.append(menu_add_todo) menu_list_todos = Gtk.MenuItem.new_with_label(_('Tasks')) menu_list_todos.connect('activate', self.on_menu_list_todos_activate) menu.append(menu_list_todos) # menu.append(Gtk.SeparatorMenuItem()) # menu_show_statistics = Gtk.MenuItem.new_with_label( # _('Statistics')) # menu_show_statistics.connect('activate', self.show_statistics) # menu.append(menu_show_statistics) menu.append(Gtk.SeparatorMenuItem()) menu_preferences = Gtk.MenuItem.new_with_label(_('Preferences')) menu_preferences.connect('activate', self.show_preferences) menu.append(menu_preferences) menus_help = Gtk.MenuItem.new_with_label(_('Help')) menus_help.set_submenu(self.get_help_menu()) menu.append(menus_help) menu.append(Gtk.SeparatorMenuItem()) menu_quit = Gtk.MenuItem.new_with_label(_('Quit')) menu_quit.connect('activate', self.quit) menu.append(menu_quit) menu.show_all() return menu
def pause(self): if not self.paused: self.paused = True self.gui.download_treestore.set_value(self.treeiter, 2, _("Download paused...")) self.decrease_down_count() self.gui.download_treestore.set_value(self.treeiter, 5, "gtk-media-play") else: self.paused = False self.increase_down_count() self.gui.download_treestore.set_value(self.treeiter, 2, _("Resuming download...")) self.gui.download_treestore.set_value(self.treeiter, 5, "gtk-media-pause")
def add_filters(filechooser,myfilter): filter = gtk.FileFilter() name = _("Supported files") filter.set_name(name + ' ' + ','.join(myfilter)) for f in myfilter: filter.add_pattern(f) filechooser.add_filter(filter) filter = gtk.FileFilter() filter.set_name(_("All files")) filter.add_pattern("*") filechooser.add_filter(filter)
def add_filters(filechooser, myfilter): filter = gtk.FileFilter() name = _("Supported files") filter.set_name(name + ' ' + ','.join(myfilter)) for f in myfilter: filter.add_pattern(f) filechooser.add_filter(filter) filter = gtk.FileFilter() filter.set_name(_("All files")) filter.add_pattern("*") filechooser.add_filter(filter)
def action_delete(self, widget): confirm = yesno((_("Remove Gtk themes")),\ (_("Are you sure you want to delete the gtk Theme \n %s ?") % self.item.dirname)) if confirm == "No": return ## remove the theme self.gtk_dict.action_delete(self.item.dirname) model = self.gtkThemes_selector.get_model() model.clear() self.list_gtk_themes() self.statbar.push( 1, (_("Gtk theme %s removed successfully") % self.item.name))
def show_alert(primary_message, secondary_message=False): dialog = Gtk.MessageDialog( None, 0, Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, _(primary_message), ) if secondary_message: dialog.format_secondary_text(_(secondary_message)) dialog.run() dialog.destroy()
def install_dialog(theme_list, archive): ## glade dialog dialog_gui = gtk.glade.XML(INSTALL_GLADE,None,APP_NAME) install_dialog = dialog_gui.get_widget("install_dialog") install_dialog.set_title(_("Scan results")) install_dialog.set_position("center") install_label = dialog_gui.get_widget("install_dialog_label") install_label.set_text(_("Scan report for : \n\ %s \n\n The followings themes are ready to install !") % archive) ## gtk if theme_list.has_key('gtk'): gtk_label = dialog_gui.get_widget("gtk_label") gtk_label.set_text('\n'.join(theme_list['gtk'])) ## icons if theme_list.has_key('icons'): icons_label = dialog_gui.get_widget("icons_label") icons_label.set_text('\n'.join(theme_list['icons'])) ## metacity if theme_list.has_key('metacity'): metacity_label = dialog_gui.get_widget("metacity_label") metacity_label.set_text('\n'.join(theme_list['metacity'])) ## cursors if theme_list.has_key('mouse'): cursors_label = dialog_gui.get_widget("cursors_label") cursors_label.set_text('\n'.join(theme_list['mouse'])) ## emerald if theme_list.has_key('emerald'): emerald_label = dialog_gui.get_widget("emerald_label") emerald_label.set_text('\n'.join(theme_list['emerald'])) ## cubemodel if theme_list.has_key('cubemodels'): cubemodels_label = dialog_gui.get_widget("cubemodels_label") cubemodels_label.set_text('\n'.join(theme_list['cubemodels'])) ## wallpaper if theme_list.has_key('wallstats'): wallpapers_label = dialog_gui.get_widget("wallpapers_label") wallpapers_label.set_text('\n'.join(theme_list['wallstats'])) ## walltimes if theme_list.has_key('walltimes'): wallpapers_label = dialog_gui.get_widget("walltimes_label") wallpapers_label.set_text('\n'.join(theme_list['walltimes'])) ## fullpack if theme_list.has_key('fullpacks'): fullpack_label = dialog_gui.get_widget("fullpacks_label") fullpack_label.set_text('\n'.join(theme_list['fullpacks'])) install_result = install_dialog.run() install_dialog.destroy() ## get glade return code if install_result == 0: return True else: return False
def __init__(self,gui): self.gui = gui self.current_page = 1 self.main_start_page = 1 self.engine_type = "video" self.num_start = 1 self.results_by_page = 25 self.name="Youtube" self.client = yt_service.YouTubeService() self.youtube_max_res = "320x240" self.media_codec = None self.thread_stop= False self.has_browser_mode = False self.vp8 = False ## the gui box to show custom filters/options self.opt_box = self.gui.gladeGui.get_widget("search_options_box") ## options labels self.order_label = _("Order by: ") self.category_label = _("Category: ") ## video quality combobox self.youtube_quality_box = self.gui.gladeGui.get_widget("quality_box") self.youtube_quality_model = gtk.ListStore(str) self.youtube_video_rate = gtk.ComboBox(self.youtube_quality_model) cell = gtk.CellRendererText() self.youtube_video_rate.pack_start(cell, True) self.youtube_video_rate.add_attribute(cell, 'text', 0) self.youtube_quality_box.add(self.youtube_video_rate) new_iter = self.youtube_quality_model.append() self.youtube_quality_model.set(new_iter, 0, _("Quality"), ) self.youtube_video_rate.connect('changed', self.on_youtube_video_rate_changed) ## youtube video quality choices self.res320 = self.gui.gladeGui.get_widget("res1") self.res640 = self.gui.gladeGui.get_widget("res2") self.res854 = self.gui.gladeGui.get_widget("res3") self.res1280 = self.gui.gladeGui.get_widget("res4") self.res1920 = self.gui.gladeGui.get_widget("res5") ## SIGNALS dic = { "on_res1_toggled" : self.set_max_youtube_res, "on_res2_toggled" : self.set_max_youtube_res, "on_res3_toggled" : self.set_max_youtube_res, "on_res4_toggled" : self.set_max_youtube_res, "on_res5_toggled" : self.set_max_youtube_res, } self.gui.gladeGui.signal_autoconnect(dic) ## start self.start_engine()
def on_time_button_clicked(self, widget): if self.switch.get_active(): Alert.show_alert(_('Your task is completed'), _('Mark as uncompleted and continue')) else: self.stop_siblings_if_started() self.track_time() widget.set_image( Gtk.Image.new_from_icon_name(self.get_started_at_icon(), Gtk.IconSize.BUTTON)) self.set_todo(self.todo) self.get_toplevel().indicator.set_icon_tracktime( self.get_started_at())
def _build_tags(self): page04 = self._new_page('Tags') self.tags = ListBoxStringType() self.tags.set_size_request(250, 250) page04.attach(self.tags, 0, 0, 3, 3) box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 5) page04.attach(box, 3, 0, 1, 2) button_add_tag = Gtk.Button.new_with_label(_('Add tag')) button_add_tag.connect('clicked', self.on_button_add_tag_clicked) box.add(button_add_tag) button_remove_tag = Gtk.Button.new_with_label(_('Remove tag')) button_remove_tag.connect('clicked', self.on_button_remove_tag_clicked) box.add(button_remove_tag)
def on_emerald_delbtn_clicked(self, widget): confirm = yesno( (_("Remove emerald theme")), (_("Are you sure you want to delete the Emerald Theme \n%s ?") % self.emerald_thname)) if confirm == "No": return print self.emerald_dict.del_item(self.emerald_thname) self.model.remove(self.iter) self.statbar.push( 1, (_("Emerald theme %s removed successfully") % self.emerald_thname))
def action_get_model(self,widget=None): selected = self.w_iconview.get_selected_items() ## check if path exist (or problems when clicking between rows..) try: row_index = selected[0] except: return self.iter = self.model.get_iter(row_index) self.item_name = self.model.get_value(self.iter,4) self.item_path = self.model.get_value(self.iter,2) self.item_description = self.model.get_value(self.iter,3) self.item_dirname = self.model.get_value(self.iter,0) self.wl_icon_gest.set_text(_("Description : %s") % self.item_description) self.w_status_bar.push(1,_("Selected icons theme : %s") % self.item_name)
def __init__(self,gladexml,emerald_dict): ## load buttons and attach signals self.emerald_dict = emerald_dict self.emerald_addbtn = gladexml.get_widget("emerald_addbtn") self.emerald_applybtn = gladexml.get_widget("emerald_applybtn") self.emerald_delbtn = gladexml.get_widget("emerald_delbtn") self.statbar = gladexml.get_widget("statusbar") dic = {"on_emerald_addbtn_clicked" : self.on_emerald_addbtn_clicked, "on_emerald_applybtn_clicked" : self.apply_emerald_theme, "on_emerald_delbtn_clicked" : self.on_emerald_delbtn_clicked, } gladexml.signal_autoconnect(dic) ## for threads self.progress_box = gladexml.get_widget("progress_box") self.progress_text = gladexml.get_widget("progress_box_text") self.main_progressbar = gladexml.get_widget("main_progressbar") ## setup the liststore model self.model = gtk.ListStore(str,gtk.gdk.Pixbuf, str, str, str, str, str, str) ## setup the iconview self.emerald_iconview = gtk.IconView(model=self.model) self.emerald_iconview.set_pixbuf_column(1) self.emerald_iconview.set_text_column(0) self.emerald_iconview.set_item_width(225); self.emerald_iconview.set_selection_mode('single') self.emerald_iconview.set_reorderable(1) ## iconview signal self.emerald_iconview.connect('selection_changed',self.get_model) self.emerald_iconview.connect('button-press-event',self.check_double_click) self.emerald_gest_info = gladexml.get_widget("emerald_gest_info") self.emerald_gest_viewer = gladexml.get_widget("emerald_gest_viewer") self.emerald_dret_label = gladexml.get_widget("emerald_dret_label") self.emerald_applybtn = gladexml.get_widget("emerald_applybtn") self.emerald_addbtn = gladexml.get_widget("emerald_addbtn") self.emerald_delbtn = gladexml.get_widget("emerald_delbtn") self.decoration_page_img = gladexml.get_widget("decoration_page_img") self.decoration_page_desc = gladexml.get_widget("decoration_page_desc") self.decoration_page_img.set_from_file(config.img_path+"//decoration.png") self.decoration_page_desc.set_text(_("Window decoration :\nManage and install your metacity/emerald themes")) self.emerald_gest_info.set_text(_("Available themes list")) ## add the iconview self.emerald_gest_viewer.add(self.emerald_iconview) self.list_emerald_themes()
def get_model(self,widget=None): selected = self.mouse_iconview.get_selected_items() ## check if path exist (or problems when clicking between rows..) try: row_index = selected[0] except: return self.item_comment = _("No_description") self.iter = self.model.get_iter(row_index) self.item_name = self.model.get_value(self.iter,0) self.item_comment = self.model.get_value(self.iter,2) self.item_path = self.model.get_value(self.iter,5) self.item_dirname = self.model.get_value(self.iter,6) self.mouse_gest_label.set_text(_("Description : %s") % self.item_comment) self.statbar.push(1,_("Selected mouse theme : %s") % self.item_name)
def make_youtube_entry(self,video,read=None): duration = video.media.duration.seconds calc = divmod(int(duration),60) seconds = int(calc[1]) if seconds < 10: seconds = "0%d" % seconds duration = "%d:%s" % (calc[0],seconds) url = video.link[1].href thumb = video.media.thumbnail[-1].url count = 0 try: count = video.statistics.view_count except: pass vid_id = os.path.basename(os.path.dirname(url)) try: vid_pic = download_photo(thumb) except: return title = video.title.text if not count: count = 0 values = {'name': title, 'count': count, 'duration': duration} markup = _("\n<small><b>view:</b> %(count)s <b>Duration:</b> %(duration)s</small>") % values if not title or not url or not vid_pic: return gobject.idle_add(self.gui.add_sound,title, vid_id, vid_pic,None,self.name,markup)
def selector_changed(self,widget): dirname = self.gtkThemes_selector.get_active_text() if self.gtk_dict.has_key(dirname): self.item = self.gtk_dict[dirname] self.gtkThemes_preview = self.item.name self.statbar.push(1,_("Gtk theme %s selected") % self.item.name) self.gtk_preview(self.item)
def __init__(self, msg, timeout = None): """ Clase auxiliar para mostrar mensajes de aviso """ self.aviso = gtk.Dialog(_('Aviso'), None, gtk.DIALOG_DESTROY_WITH_PARENT, (gtk.STOCK_CANCEL, gtk.RESPONSE_CLOSE)) self.timeout = timeout self.tick = 0.1 self.fraction = self.tick/self.timeout mensaje = gtk.Label(msg) mensaje.set_line_wrap(True) mensaje.set_max_width_chars(80) logoad = gtk.Image() iconad = self.aviso.render_icon(gtk.STOCK_DIALOG_WARNING, 1) self.countdown = gtk.ProgressBar() self.countdown.set_fraction(1.0) self.aviso.set_icon(iconad) self.aviso.vbox.pack_start(mensaje, True, True, 10) self.aviso.vbox.pack_start(self.countdown, True, True, 5) self.aviso.show_all() if self.timeout: self.t = Timer(self.tick, self.update) self.t.start() self.response = self.aviso.run() self.t.cancel() self.aviso.destroy()
def on_key_press(symbol, modifiers): global selected global process global game_running if symbol == key.UP: selected = (selected - 1) % len(game_infos) refresh() elif symbol == key.DOWN: selected = (selected + 1) % len(game_infos) refresh() elif symbol == key.F and (modifiers&key.MOD_ALT) != 0: #window.set_fullscreen(not window.fullscreen, **mconf.window_size) pass elif symbol == key.ESCAPE: kill_proc() raise SystemExit() elif symbol == key.RETURN: kill_proc() exec = game_infos[selected]['execute'] if exec: exec_dir = os.path.join(mconf.games_folder, game_infos[selected]['name']) print(_('Ejecutando [{exe}] con CWD=[{cwd}]').format(exe=exec, cwd=exec_dir)) exec_list = shlex.split(exec, posix=True) exec_list[0] = os.path.join(exec_dir, exec_list[0]) print(exec_list) try: #Windows hack: Give focus to window TODO: is this still needed? #windows-only si = subprocess.STARTUPINFO() si.dwFlags = subprocess.STARTF_USESHOWWINDOW SW_SHOW = 5 si.wShowWindow = SW_SHOW process = subprocess.Popen(exec_list, cwd=exec_dir, startupinfo=si) last_input = 0 game_running = game_infos[selected]['name'] # gui.process = subprocess.Popen(exec_path, cwd=exec_dir) print(_('OK')) except: print(_('ERROR AL EJECUTAR: ') + str(sys.exc_info()[0])) process = None game_running = None print('A key was pressed sym=' + key.symbol_string(symbol) + ' mod=' + key.modifiers_string(modifiers))
def apply_metacity_theme(self,widget=None,dir=None): if dir: self.metacity_thdir = dir self.metacity_thname = dir if not self.metacity_thdir: print "no theme selected..." return self.metacity_dict.set_active_item(self.metacity_thname) self.statbar.push(1,(_("Metacity theme %s successfully activated") % self.metacity_thname))
def create_filechooser_save(): buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE, gtk.RESPONSE_OK) filechooser = gtk.FileChooserDialog((_("Save...")), None, gtk.FILE_CHOOSER_ACTION_SAVE, buttons) filechooser.set_do_overwrite_confirmation(True) add_filters(filechooser) return filechooser
def __init__(self,gladexml,gstyle_obj): ## load buttons and attach signals self.gstyle_obj = gstyle_obj self.mouse_dict = self.gstyle_obj.mouse_dict self.mouse_scroll = gladexml.get_widget("mouse_scroll") self.mouse_gest_label = gladexml.get_widget("mouse_gest_label") self.mouse_gest_label.set_text(_("Installed mouse themes list")) self.mouse_gest_colorbtn = gladexml.get_widget("mouse_gest_colorbtn") self.mouse_gest_welcomentry = gladexml.get_widget("mouse_gest_welcomentry") self.mouse_page_img = gladexml.get_widget("mouse_page_img") self.mouse_page_img.set_from_file("%s/mouse.png" % config.img_path) self.mouse_page_desc = gladexml.get_widget("mouse_page_desc") self.mouse_page_desc.set_text(_("\nmouse themes : \nOrganize your mouse themes...\n")) self.mouse_gest_applybtn = gladexml.get_widget('mouse_gest_applybtn') self.mouse_gest_delbtn = gladexml.get_widget('mouse_gest_delbtn') self.statbar = gladexml.get_widget("statusbar") dic = {"on_mouse_addbtn_clicked" : self.action_add, "on_mouse_applybtn_clicked" : self.action_apply, "on_mouse_delbtn_clicked" : self.action_del, } gladexml.signal_autoconnect(dic) ## gui self.model = gtk.ListStore(str,gtk.gdk.Pixbuf,str,str,str,str,str,str) self.mouse_iconview = gtk.IconView(model=self.model) # Setup GtkIconView self.mouse_iconview.set_pixbuf_column(1) self.mouse_iconview.set_text_column(0) ## options self.mouse_iconview.set_columns(0) self.mouse_iconview.set_selection_mode('single') self.mouse_iconview.set_reorderable(1) self.mouse_iconview.set_item_width(150); self.mouse_iconview.connect('selection_changed',self.get_model) self.mouse_iconview.connect('button-press-event',self.check_double_click) self.mouse_scroll.add(self.mouse_iconview) self.list_mouse_themes()
def action_apply(self,widget=None,item=None,name=None): if name: item = self.mouse_dict.get(name) if item: self.item_name = item.name self.item_path = item.path else: return self.mouse_dict.set_active_item(self.item_path) self.statbar.push(1,_("Mouse theme %s successfully activated") % self.item_name)
def get_model(self,widget=None): """Action to get the information theme metacity""" selected = self.metacityTree.get_selection() self.iter = selected.get_selected()[1] ## else extract needed metacity's infos self.metacity_thname = self.model.get_value(self.iter, 0) ## return only theme name and description then extract infos from hash self.metacity_thdir = self.model.get_value(self.iter, 1) # print in the gui make_metacity_preview(self.metacity_container, os.path.basename(self.metacity_thdir)) self.statbar.push(1,_("Selected metacity theme : %s") % self.metacity_thname)
def get_down_model(self,widget): selected = self.cubemodels_down_iconview.get_selected_items() ## check if path exist (or problems when clicking between rows..) try: row_index = selected[0] except: return self.down_iter = self.cubemodels_down_model.get_iter(row_index) self.down_name = self.cubemodels_down_model.get_value(self.down_iter,1) self.down_link = self.cubemodels_down_model.get_value(self.down_iter,2) self.statbar.push(1,(_("Selected cubemodels download : %s") % self.down_name))
def do_bug_report_dialog(parent, back_trace, step): """Show a dialog with bug report form and if user clicks YES, send it.""" info = state_info(step) bug_report = back_trace + "\n\n" + 30*"=" + "\n\n" + info dialog = BugReportDialog(parent) dialog.set_bug_report(bug_report) status = dialog.ShowModal() address, message = dialog.get_address_and_message() dialog.Destroy() if status == wx.ID_OK: try: send_bug_report(address, message, bug_report) except Exception, e: wx.MessageBox(_("Sending of bug report failed:\n\n") + str(e), _("Send failed"), wx.ICON_ERROR) else: wx.MessageBox(_("Bug report was sent."), _("Send successful"))
def get_model(self,widget=None): selected = self.cubemodels_iconview.get_selected_items() ## check if path exist (or problems when clicking between rows..) try: row_index = selected[0] except: return self.iter = self.model.get_iter(row_index) self.item_name = self.model.get_value(self.iter,0) self.item_path = self.model.get_value(self.iter,2) self.item_ini = self.model.get_value(self.iter,3) self.statbar.push(1,(_("Selected cubemodels theme : %s") % self.item_name))
def __init__(self,gladexml,gtk_dict): self.gtk_dict = gtk_dict self.gclient = gconf.client_get_default() self.window = gladexml.get_widget("main_window") self.statbar = gladexml.get_widget("statusbar") self.gtk_img = gladexml.get_widget("gtk_img") self.gtk_label = gladexml.get_widget("gtk_label") self.gtk_img.set_from_file("%s/gtk-icon.png" % config.img_path) self.gtk_label.set_text(_("Gtk-themes:\nManage and install your Gtk themes...")) self.model = gtk.ListStore(str) ## glade widget for preview pgladexml = gtk.glade.XML(PREVIEW_GLADE,None,config.APP_NAME) self.gtkThemes_preview_cont = gladexml.get_widget('gtkpreview_container') self.preview = pgladexml.get_widget('gtk_preview') self.gtkpreview_infos = pgladexml.get_widget('gtkpreview_infos') self.gtkThemes_preview_cont.add(self.preview) self.gtkThemes_preview_cont.show() ## gui self.gtkThemes_previewer = gladexml.get_widget("gtkThemes_preview") self.gtkThemes_gest_label = gladexml.get_widget("gtkThemes_gest_label") self.gtkThemes_gest_colorbtn = gladexml.get_widget("gtkThemes_gest_colorbtn") self.gtkThemes_gest_welcomentry = gladexml.get_widget("gtkThemes_gest_welcomentry") self.gtkThemes_selector = gladexml.get_widget("gtkThemes_selector") self.gtkThemes_selector.set_model(self.model) self.gtkThemes_gest_applybtn = gladexml.get_widget('gtkThemes_gest_applybtn') self.gtkThemes_gest_delbtn = gladexml.get_widget('gtkThemes_gest_delbtn') ##load signal dic = {"on_gtk_addbtn_clicked" : self.action_add, "on_gtkThemes_gest_applybtn_clicked" : self.action_apply, "on_gtkThemes_gest_delbtn_clicked" : self.action_delete, "on_gtkThemes_selector_changed" : self.selector_changed, } gladexml.signal_autoconnect(dic) self.gtkThemes_preview = "" self.gtkThemes_save = self.gclient.get_string("/desktop/gnome/interface/gtk_theme") self.gtkThemes_thdir = "/usr/share/themes/Default" ## default gtk theme... self.gtkThemes_thname = "Default" if self.gtkThemes_save == "": ## set default gtk theme self.gtkThemes_save = "Default" print "Current gtk theme: %s" % self.gtkThemes_save self.list_gtk_themes()
def error(self, msg, details = "" ): """Print an error message and stop the processing""" self.stop() wx.MessageBox(msg, _("Rendering Error"), wx.ICON_ERROR) if hasattr(self, 'eventHandler'): wx.PostEvent(self.eventHandler, GenericGuiEvent("Rendering Error. Sorry.") ) wx.PostEvent(self.eventHandler, UpdateProgressEvent(-1) )