def _set_model(self): """ Set the correct treemodel for the current view """ debug.dprint("VIEWS: Package_view._set_model(); changing to '" + MODEL_NAMES[self.current_view] + "' view model") self.set_model(self.view_model[MODEL_NAMES[self.current_view]]) if self.current_view in [PACKAGES, SEARCH]: #self.remove_model() self.popup_menuitems["deselect_all"].hide() self.popup_menuitems["select_all"].hide() #self.enable_column_sort() else: #debug.dprint("VIEWS: Package_view._set_model(); changing to '" + MODEL_NAMES[self.current_view] + "' view") self.popup_menuitems["deselect_all"].show() self.popup_menuitems["select_all"].show() #debug.dprint("VIEWS: _set_model(); disabling column sort") self.enable_column_sort() #disable_column_sort()
def renum_ids(self, path, id): if not id or path == None: return try: iter = self.queue_model.get_iter(path) while iter: self.queue_model.set_value(iter, self.queue_model.column['id'], id) iter = self.queue_model.iter_next(iter) id += 1 except: debug.dprint( "TERM_QUEUE: renum_ids; exception raised during renumber, path, id = " + str(path) + ", " + str(id)) del iter
def add_keyword(self, widget): arch = "~" + backends.portage_lib.get_arch() name = utils.get_treeview_selection(self, MODEL_ITEM["package"]).full_name string = name + " " + arch + "\n" debug.dprint("VIEWS: Package view add_keyword(); %s" % string) def callback(): self.mainwindow_callback( "refresh", {'caller': 'VIEWS: Package view add_keyword()'}) db.userconfigs.set_user_config('KEYWORDS', name=name, add=arch, callback=callback)
def setup_plugins(self): """set up our plug-in manager and variables""" #Plugin-related statements self.needs_plugin_menu = False #debug.dprint("PluginHandler; setup_plugins(): path_list %s" #% config.Prefs.plugins.path_list) debug.dprint("PluginHandler: setup_plugins: plugin path: %s" % config.Prefs.PLUGIN_DIR) self.plugin_root_menu = Gtk.MenuItem(_("Active Plugins")) self.plugin_menu = Gtk.Menu() self.plugin_root_menu.set_submenu(self.plugin_menu) self.wtree.get_object("menubar").append(self.plugin_root_menu) self.plugin_manager = PluginManager(self) self.plugin_package_tabs = {} self.packagebook = None
def get_sync_info(): """gets and returns the timestamp info saved during the last portage tree sync""" debug.dprint("BACKENDS Utilities: get_sync_info();") last_sync = _( "Unknown" ) + ' ' # need a space at end of string cause it will get trimmed later valid_sync = False try: #debug.dprint("BACKENDS Utilities: get_sync_info(); timestamp path = " \ # + backends.portage_lib.settings.portdir + "/metadata/timestamp") f = open(backends.portage_lib.settings.portdir + "/metadata/timestamp") #debug.dprint("BACKENDS Utilities: get_sync_info(); file open") data = f.read() #debug.dprint("BACKENDS Utilities: get_sync_info(); file read") f.close() #debug.dprint("BACKENDS Utilities: get_sync_info(); file closed") #debug.dprint("BACKENDS Utilities: get_sync_info(); data = " + data) if data: try: #debug.dprint("BACKENDS Utilities: get_sync_info(); trying utf_8 encoding") last_sync = (str(data).decode('utf_8').encode( "utf_8", 'replace')) valid_sync = True except: try: #debug.dprint("BACKENDS Utilities: get_sync_info(); trying iso-8859-1 encoding") last_sync = (str(data).decode('iso-8859-1').encode( 'utf_8', 'replace')) valid_sync = True except: debug.dprint( "BACKENDS Utilities: get_sync_info(); Failure = unknown encoding" ) else: debug.dprint("BACKENDS Utilities: get_sync_info(); No data read") #except os.error: except IOError as v: try: (code, message) = v except: code = 0 message = v debug.dprint("BACKENDS Utilities: get_sync_info(); I/O Error: " + str(message) + " (" + str(code) + ")") debug.dprint("BACKENDS Utilities: get_sync_info(); last_sync = " + last_sync[:-1]) return last_sync[:-1], valid_sync
def __init__(self, call_back, run_anyway=False): # setup glade self.gladefile = config.Prefs.DATA_PATH + config.Prefs.use_gladefile self.wtree = gtk.glade.XML(self.gladefile, "run_dialog") # register callbacks callbacks = { "on_help": self.help, "on_execute": self.execute, "on_cancel": self.cancel, "on_comboboxentry1_changed": self.command_changed } self.wtree.signal_autoconnect(callbacks) self.command = None self.call_back = call_back self.run_anyway = run_anyway if config.Prefs: #debug.dprint("COMMAND: config.Prefs == True") self.history = config.Prefs.run_dialog.history else: debug.dprint("COMMAND: config.Prefs == False") self.history = [ "", "emerge ", "ACCEPT_KEYWORDS='~x86' emerge ", "USE=' ' emerge ", "ACCEPT_KEYWORDS='~x86' USE=' ' emerge" ] #debug.dprint("COMMAND: self.history:") #debug.dprint(self.history) self.window = self.wtree.get_widget("run_dialog") self.combo = self.wtree.get_widget("comboboxentry1") self.entry = self.combo.child #self.list = self.wtree.get_widget("combo-list") # Build a formatted combo list from the versioninfo list self.comboList = gtk.ListStore(str) index = 0 for x in self.history: # Set the combo list self.comboList.append([x]) # Set the comboboxentry to the new model self.combo.set_model(self.comboList) self.combo.set_text_column(0) self.entry.connect("activate", self.activate, self.command) if config.Prefs: self.window.resize(config.Prefs.run_dialog.width, config.Prefs.run_dialog.height) # MUST! do this command last, or nothing else will _init__ # after it until emerge is finished. # Also causes runaway recursion. self.window.connect("size_request", self.on_size_request)
def on_package_keywords_commit(self, button_widget): debug.dprint("ADVEMERGE: on_package_keywords_commit()") keyword = self.get_keyword() if not keyword: return addlist = [keyword] if keyword.startswith("-"): removelist = [keyword[1:]] else: removelist = ["-" + keyword] verInfo = self.current_verInfo ebuild = verInfo["name"] okay = db.userconfigs.set_user_config('KEYWORDS', ebuild=ebuild, add=addlist, remove=removelist, callback=self.reload)
def find_best_match(search_key): # lifted from gentoolkit and updated """Returns a Package object for the best available installed candidate that matched the search key. Doesn't handle virtuals perfectly""" # FIXME: How should we handle versioned virtuals?? #cat,pkg,ver,rev = split_package_name(search_key) full_name = split_atom_pkg(search_key)[0] if "virtual" == get_category(full_name): #t= get_virtual_dep(search_key) t = settings.trees[settings.settings["ROOT"]]["vartree"].dep_bestmatch(full_name) else: t = settings.trees[settings.settings["ROOT"]]["vartree"].dep_bestmatch(search_key) if t: #debug.dprint("PORTAGELIB: find_best_match(search_key)=" + search_key + " ==> " + str(t)) return t debug.dprint("PORTAGELIB: find_best_match(search_key)=" + search_key + " None Found") return None
def get_digest(ebuild): ## deprecated """Returns digest of an ebuild""" mydigest = settings.portdb.finddigest(ebuild) digest_file = [] if mydigest != "": try: myfile = open(mydigest, "r") for line in myfile.readlines(): digest_file.append(line.split(" ")) myfile.close() # Fixme unused e except SystemExit as e: raise # Needed else can't exit except Exception as e: debug.dprint("PORTAGELIB: get_digest(): Exception: %s" % e) return digest_file
def get_sets_list(filename): """Get the package list file and turn it into a tuple attributes: pkgs[key = full_name] = [atoms, version]""" pkgs = {} try: list = read_bash(filename) except: debug.dprint( "PORTAGELIB: get_sets_list(); Failure to locate file: %s" % filename) return None # split the atoms from the pkg name and any trailing attributes if any for item in list: parts = split_atom_pkg(item) pkgs[parts[0]] = parts[1:] return pkgs
def split_package_name( name): # lifted from gentoolkit, handles vituals for find_best_match() """Returns a list on the form [category, name, version, revision]. Revision will be 'r0' if none can be inferred. Category and version will be empty, if none can be inferred.""" debug.dprint(" * PORTAGELIB: split_package_name() name = " + name) r = portage.catpkgsplit(name) if not r: r = name.split("/") if len(r) == 1: return ["", name, "", "r0"] else: return r + ["", "r0"] if r[0] == 'null': r[0] = '' return r
def get_tab_list(self): """creates the current notebook tab list""" #tabs_showing = 0 self.visible_tablist = [] tab_num = 0 #debug.dprint("NOTEBOOK: get_tab_list -- self.tab_showing") #debug.dprint(self.tab_showing) for tab in self.tab_showing: #debug.dprint(tab_num) #debug.dprint(tab) if tab: self.visible_tablist += [tab_num] tab_num += 1 debug.dprint("NOTEBOOK: get_tab_list() new self.visible_tablist: %s" % self.visible_tablist) return
def on_color_set(self, button_widget): debug.dprint("CONFIGDIALOG: on_color_set()") # if button is default-button: change colour in all buttons using default. color = button_widget.get_color() ext = None if button_widget.get_property('name') == 'default_fg': ext = "fg" elif button_widget.get_property('name') == 'default_bg': ext = "bg" if not ext or not hasattr(self, 'tagnamelist'): return for name in self.tagnamelist: widget = self.wtree.get_widget('_'.join([name, ext])) if widget: if widget.get_alpha() < 40000: widget.set_color(color)
def set_make_conf(property, add='', remove='', replace='', callback=None): """ Sets a variable in make.conf. If remove: removes elements of <remove> from variable string. If add: adds elements of <add> to variable string. If replace: replaces entire variable string with <replace>. if remove contains the variable name, the whole variable is removed. e.g. set_make_conf('USE', add=['gtk', 'gtk2'], remove=['-gtk', '-gtk2']) e.g. set_make_conf('ACCEPT_KEYWORDS', remove='ACCEPT_KEYWORDS') e.g. set_make_conf('PORTAGE_NICENESS', replace='15') """ debug.dprint("PORTAGELIB: set_make_conf()") command = '' file = 'make.conf' if isinstance(add, list): add = ' '.join(add) if isinstance(remove, list): remove = ' '.join(remove) if isinstance(replace, list): replace = ' '.join(replace) config_path = portage_const.USER_CONFIG_PATH if not os.access(portage_const.MAKE_CONF_FILE, os.W_OK): command = (config.Prefs.globals.su + ' "python ' + config.Prefs.DATA_PATH + 'backends/set_config.py -d -f %s ' %file) command = (command + '-p %s ' % property) if add != '': command = (command + '-a %s ' %("'" + add + "'")) if remove != '': command = (command + '-r %s' %("'" + remove + "'")) command = command + '"' debug.dprint(" * PORTAGELIB: set_make_conf(); command = %s" %command ) if not callback: callback = reload_portage app = SimpleTerminal(command, False, dprint_output='SET_MAKE_CONF CHILD APP: ', callback=Dispatcher(callback)) app._run() else: add = add.split() remove = remove.split() set_config.set_make_conf(property, add, remove, replace) if callback: callback() else: reload_portage() # This is slow, but otherwise portage doesn't notice the change. #reload_portage() # Note: could perhaps just update portage.settings. # portage.settings.pmaskdict, punmaskdict, pkeywordsdict, pusedict # or portage.portdb.mysettings ? return True
def environment(): """sets up the environment to run sub processes""" env = os.environ #debug.dprint("UTILS: environment(), env before & after our additions") #debug.dprint(env) if "PORTAGE_ELOG_SYSTEM" in env: modules = env["PORTAGE_ELOG_SYSTEM"].split() if 'echo' in modules: modules.remove('echo') env["PORTAGE_ELOG_SYSTEM"] = ' '.join(modules) debug.dprint( "UTILS: environment(); Found 'echo' in " "PORTAGE_ELOG_SYSTEM. Removed for porthole's use only, " "it now is: " + str(env["PORTAGE_ELOG_SYSTEM"])) #env["NOCOLOR"] = "true" #debug.dprint(env) return env
def run(self): """fill upgrade tree""" debug.dprint( "READERS: DeprecatedReader; process id = %d *******************" % os.getpid()) # find deprecated packages for cat, packages in self.installed_items: #debug.dprint("READERS: DeprecatedReader; cat = " + str(cat)) for name, package in packages.items(): #debug.dprint("READERS: DeprecatedReader; name = " + str(name)) self.count += 1 if self.cancelled: self.done = True return deprecated = package.deprecated if deprecated: debug.dprint( "READERS: DeprecatedReader; found deprecated package: " + package.full_name) self.pkg_dict["Packages"][package.full_name] = package self.pkg_count["Packages"] += 1 else: # check for deprecated ebuilds ebuilds = package.get_installed() for ebuild in ebuilds: overlay = portage_lib.get_overlay(ebuild) if type(overlay) is IntType: # catch obsolete # add the ebuild to Ebuilds list debug.dprint( "READERS: DeprecatedReader; found deprecated ebuild: " + ebuild) self.pkg_dict["Ebuilds"][ package.full_name] = package self.pkg_count["Ebuilds"] += 1 debug.dprint("READERS: DeprecatedReader; done checks, totals next") self.pkg_dict_total = 0 for key in self.pkg_count: self.pkg_dict_total += self.pkg_count[key] if self.pkg_dict[key] == {}: pkg = Package(_("None")) self.pkg_dict[key][_("None")] = pkg # set the thread as finished self.done = True debug.dprint("READERS: DeprecatedReader; done :)") return
def load_help_page(name): """Load a locale-specific help page with the default browser.""" debug.dprint("LOADERS: load_help_page: %s" % name) lc = config.Prefs.globals.LANG if not lc: lc = "en" helpdir = os.path.join(config.Prefs.DATA_PATH, 'help') if os.access(os.path.join(helpdir, lc, name), os.R_OK): pagename = "file://" + os.path.join(helpdir, lc, name) elif os.access(os.path.join(helpdir, lc.split('_')[0], name), os.R_OK): pagename = "file://" + os.path.join(helpdir, lc.split('_')[0], name) elif os.access(os.path.join(helpdir, "en", name), os.R_OK): pagename = "file://" + os.path.join(helpdir, "en", name) else: debug.dprint(" * LOADERS: failed to find help file '%s' with LANG='%s'!" % (name, config.Prefs.globals.LANG)) return False load_web_page(pagename)
def on_config_response(self, dialog_widget, response_id): """ Parse dialog response (ok, cancel, apply or help clicked) """ debug.dprint("CONFIGDIALOG: on_config_response(): response_id '%s'" % response_id) if response_id == gtk.RESPONSE_OK: self.apply_widget_values() self.window.destroy() elif response_id == gtk.RESPONSE_CANCEL: self.window.destroy() elif response_id == gtk.RESPONSE_APPLY: self.apply_widget_values() elif response_id == gtk.RESPONSE_HELP: #Display help file with web browser load_web_page('file://' + config.Prefs.DATA_PATH + 'help/customize.html') else: pass
def get_properties(ebuild): """Get all ebuild variables in one chunk.""" ebuild = str(ebuild) #just in case if settings.portdb.cpv_exists(ebuild): # if in portage tree try: return Properties( dict( zip(settings.keys, settings.portdb.aux_get(ebuild, portage.auxdbkeys)))) except IOError, e: # Sync being performed may delete files debug.dprint(" * PORTAGELIB: get_properties(): IOError: %s" % str(e)) return Properties() except Exception, e: debug.dprint(" * PORTAGELIB: get_properties(): Exception: %s" % str(e)) return Properties()
class Plugin: """Class that defines all of our plugins""" def __init__(self, name, path, manager): debug.dprint("PLUGIN: init(); New plugin being made:" " '%(name)s' in %(path)s" % locals()) self.name = name self.path = path self.event_table = {} self.manager = manager initialized = self.initialize_plugin() self.enabled = False self.is_installed = None def initialize_plugin(self): try: os.chdir(self.path) debug.dprint("PLUGIN: initialize_plugin;" " cwd: %s !!!!!!!!!!!!!!!!!" % os.getcwd()) #find_results = imp.find_module(self.name, self.path) #self.module = imp.load_module(self.name, *find_results) #plugin_name = self.path + self.name plugin_name = '.'.join(['porthole','plugins', self.name]) debug.dprint('Plugin name = ' + plugin_name) # #self.module = my_import(plugin_name) self.module = __import__(plugin_name, [], [], ['not empty']) debug.dprint('Plugin module = ' + str(self.module)) self.valid = True except ImportError, e: debug.dprint("PLUGIN: initialize_plugin(); ImportError '%s'" % e) debug.dprint("PLUGIN: initialize_plugin(); Error loading plugin" " '%s' in %s" % (self.name, self.path)) self.valid = self.is_installed = False return False debug.dprint("PLUGIN: initialize_plugin(); !!!!!!!!!!!!!!!!!!!!!!!!!!") self.event_table = self.module.event_table self.desc = self.module.desc self.is_installed = self.module.is_installed debug.dprint( "PLUGIN: %s event_table = %s" %(self.name, str(self.event_table))) debug.dprint("PLUGIN: %s desc = %s" %(self.name, str(self.desc))) debug.dprint( "PLUGIN: %s is_installed = %s" %(self.name, str(self.is_installed))) if not self.is_installed: self.enabled = False self.event("disable")
def _save_as_ok_func(self, filename): """file selector callback function""" debug.dprint("FILESELECTOR: Entering _save_as_ok_func") if self.overwrite_confirm and (not self.filename or filename != self.filename): if os.path.exists(filename): err = _("Ovewrite existing file '%s'?") % filename dialog = Gtk.MessageDialog(self.window, Gtk.DialogFlags.MODAL, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, err) result = dialog.run() dialog.destroy() if result != Gtk.ResponseType.YES: return False self.filename = filename return True
def enable_plugin(): global menuitem1, menuitem2, enabled, initialized if initialized == False: debug.dprint(plugin_name + " enable_plugin: not initialized!") return False elif not is_installed: debug.dprint(plugin_name + " enable_plugin: target command not installed.") return False debug.dprint(plugin_name + " enable_plugin: generating new menuitem") menuitem1 = manager.new_menuitem(_("Etc-Proposals")) if is_root(): debug.dprint(plugin_name + " enabling plugin to run_as_user") menuitem1.connect("activate", run_as_user) else: debug.dprint(plugin_name + " enabling plugin to run_as_root") menuitem1.connect("activate", run_as_root) enabled = True return True
def get_slot(ebuild): """Get the SLOT from the specified ebuild""" ebuild = str(ebuild) #just in case if settings.portdb.cpv_exists(ebuild): # if in portage tree try: return settings.portdb.aux_get(ebuild, ['SLOT'])[0] except IOError as e: # Sync being performed may delete files debug.dprint(" * PORTAGELIB: get_slot(): IOError: %s" % str(e)) return '' except Exception as e: debug.dprint(" * PORTAGELIB: get_slot(): Exception: %s" % str(e)) return '' else: vartree = settings.trees[settings.settings["ROOT"]]["vartree"] if vartree.dbapi.cpv_exists(ebuild): # elif in installed pkg tree return vartree.dbapi.aux_get(ebuild, ['SLOT'])[0] else: return ''
def get_metadata(cpv): """Get the metadata for a package's cpv' This will take into account the overlay it is in. Failing that it will default to the main tree """ try: debug.dprint("PORTAGELIB: get_metadata(); cpv = " + cpv) return parse_metadata(os.path.join(get_pkg_path(cpv), "metadata.xml")) except: try: debug.dprint("PORTAGELIB: get_metadata(); " "failed to get %s, using main tree" % os.path.join(get_pkg_path(cpv), "metadata.xml")) return parse_metadata( os.path.join(settings.portdir, get_full_name(cpv), "metadata.xml")) except: return None
def history_add(self): """adds the command to the history if not already in""" if self.command not in self.history: length = len(self.history) if length > config.Prefs.run_dialog.default_history: length = min(length, config.Prefs.run_dialog.history_length) old_history = self.history[config.Prefs.run_dialog. default_history:length] self.history = self.history[:config.Prefs.run_dialog. default_history] self.history.append(self.command) self.history += old_history else: self.history.append(self.command) debug.dprint("COMMAND.history_add(): new self.history:") debug.dprint(self.history) config.Prefs.run_dialog.history = self.history return
def _save_as_ok_func(self, filename): """file selector callback function""" debug.dprint("FILESELECTOR: Entering _save_as_ok_func") old_filename = self.filename if self.overwrite_confirm and (not self.filename or filename != self.filename): if os.path.exists(filename): err = _("Ovewrite existing file '%s'?") % filename dialog = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, err) result = dialog.run() dialog.destroy() if result != gtk.RESPONSE_YES: return False self.filename = filename return True
def reload_world(self): debug.dprint("PORTAGELIB: reset_world();") world = [] try: file = open(os.path.join('/', portage.WORLD_FILE), "r") #"/var/lib/portage/world", "r") world = file.read().split() file.close() except: debug.dprint("PORTAGELIB: get_world(); Failure to locate file: '%s'" %portage.WORLD_FILE) debug.dprint("PORTAGELIB: get_world(); Trying '/var/cache/edb/world'") try: file = open("/var/cache/edb/world", "r") world = file.read().split() file.close() debug.dprint("PORTAGELIB: get_world(); OK") except: debug.dprint("PORTAGELIB: get_world(); Failed to locate the world file") self._world = world
def done(self, result): debug.dprint("TERM_QUEUE: done(); result = " + str(result)) self.set_process(result) if self.last_run_iter: self.last_run_iter = self.process_iter.copy( ) #self.queue_model.iter_next(self.last_run_iter) else: self.last_run_iter = self.queue_model.get_iter_first() self.task_completed = True if not self.queue_paused: # get the next process self.next() # check for pending processes, and run them self.start(False) if self.term.tab_showing[TAB_QUEUE]: # update the queue tree wait_for = self.clicked() del wait_for
def show_flags( use_flags, ebuild_use_flags, id_overrides=False, first_flag=True): """runs through the list of flags and formats and prints them""" #debug.dprint("SUMMARY: SHOW_PROPS(),show_flags(); use_flags = " +str( use_flags) + ", ebuild_use_flags = " + str(ebuild_use_flags)) #first_flag = True if id_overrides: full_list = abs_list(iuse) else: full_list = [] for flag in use_flags: if id_overrides: debug.dprint("SUMMARY: SHOW_PROPS(),show_flags(); flag = " +str(flag) + " " + str(full_list)) else: debug.dprint("SUMMARY: SHOW_PROPS(),show_flags(); flag = " +str(flag)) # Check to see if flag applies: flag_active = False myflag = abs_flag(flag) if myflag in ebuild_use_flags: debug.dprint("SUMMARY: SHOW_PROPS(),show_flags(); flag in ebuild_use_flags = True" ) flag_active = True elif '-'+myflag in ebuild_use_flags: flag = '-' + myflag if not first_flag: append(", ", "value") else: first_flag = False show_flag(flag, flag_active, id_overrides) if myflag in full_list: full_list.remove(myflag) else: debug.dprint("SUMMARY: SHOW_PROPS(),show_flags(); flag in full_list: " + myflag) if id_overrides and len(full_list): # print remaining flags for flag in full_list: if not first_flag: append(", ", "value") else: first_flag = False flag_override = False if flag in ebuild_use_flags: debug.dprint("SUMMARY: SHOW_PROPS(),show_flags(); flag_override = True" ) flag_override = True elif '-'+flag in ebuild_use_flags: flag = '-' + flag show_flag(flag, False, flag_override)
def items_switch(self, direction): """ Switch two adjacent queue items; direction is either 1 [down] or -1 [up] """ debug.dprint("TERM_QUEUE: Switching queue items.") # get the selected iter selected_iter = get_treeview_selection(self.queue_tree) # get its path path = self.queue_model.get_path(selected_iter)[0] # only move up if it's not the first entry, # only move down if it's not the last entry if (not direction and path > 0) or \ (direction and path < len(self.queue_model)): # get the adjacent values destination_iter = self.queue_model.get_iter(path + direction) destination_id = self.queue_model.get_value( destination_iter, self.queue_model.column['id']) destination_icon = self.queue_model.get_value( destination_iter, self.queue_model.column['icon']) sel_id = self.queue_model.get_value(selected_iter, self.queue_model.column['id']) sel_icon = self.queue_model.get_value( selected_iter, self.queue_model.column['icon']) # switch places and make sure the original is still selected self.queue_model.swap(selected_iter, destination_iter) self.queue_model.set_value(selected_iter, self.queue_model.column['id'], destination_id) self.queue_model.set_value(destination_iter, self.queue_model.column['id'], sel_id) if self.paused_path == path or self.paused_path == path + direction: self.queue_model.set_value(selected_iter, self.queue_model.column['icon'], destination_icon) self.queue_model.set_value(destination_iter, self.queue_model.column['icon'], sel_icon) self.paused_iter = self.queue_model.get_iter(self.paused_path) self.queue_tree.get_selection().select_path(path + direction) else: debug.dprint("TERM_QUEUE: cannot move first or last item") # We're done, reset queue moves result = self.clicked(self.queue_tree) del path, selected_iter, destination_iter, sel_id, sel_icon, destination_id, destination_icon