def menuOptionChanged(widget, key, value): global browser_pid if key == "browser": karamba.setMenuConfigOption(widget, "browser", 0) command = ["kdialog", "--title", "Enter the path to your favorite browser", "--inputbox", "Path to browser", "/usr/bin/mozilla"] browser_pid = karamba.executeInteractive(widget, command)
def menuOptionChanged(widget, key, value): global g_configGuiPid karamba.setMenuConfigOption(widget, "config_gui", 0) if key == "config_gui": if g_configGuiPid == None: # Launch config GUI gui=os.path.join( Globals().nsCGuiBaseDir, "launchGUI" ) cmd = ["python", gui] g_configGuiPid=karamba.executeInteractive(widget, cmd) else: tools.msgDebug("GUI already running", __name__)
def menuOptionChanged(widget, key, value): global g_configGuiPid karamba.setMenuConfigOption(widget, "config_gui", 0) if key == "config_gui": if g_configGuiPid == None: # Launch config GUI gui = os.path.join(Globals().nsCGuiBaseDir, "launchGUI") cmd = ["python", gui] g_configGuiPid = karamba.executeInteractive(widget, cmd) else: tools.msgDebug("GUI already running", __name__)
def menuOptionChanged(widget, key, value): global themePath, theme_dir, chtheme_pid, procoutformat_pid, align_pid chtheme_pid = None procoutformat_pid = None align_pid = None chtheme_cmd = [ 'kdialog', '--title', 'Choose theme', '--radiolist', 'Choose theme' ] align_cmd = [ 'kdialog', '--title', 'Set Alignment', '--radiolist', 'Set the alignment for the command text.', 'left', 'Left', 'off', 'right', 'Right', 'off', 'default', 'Reset to theme default', 'on' ] # padding_cmd = ['kdialog', '--title', 'Set Padding', '--inputbox', 'Set maximum length for the command text. Enter an integer number. The default value for flatgray is 13', '13'] procoutformat_cmd = [ 'kdialog', '--title', 'Set Output format', '--inputbox', 'Set the column order for the output. Syntax is important here. Must include all columns.\n\nType \"default\" to reset to the default.\n\nDefault value is: %(cpu_percent)s %(command)s %(memory)s\n\nExamples: %(memory)s %(command)s %(cpu_percent)s\n%(command)s %(cpu_percent)s %(memory)s', '%(cpu_percent)s %(command)s %(memory)s' ] if key == "theme": listing = [] if themePath[-3:] == "skz": skz_file = zipfile.ZipFile(themePath, 'r') ziplisting = skz_file.namelist() skz_file.close() for member in ziplisting: if member.find(theme_dir) > -1: path = member.split("/") if len(path) == 3 and path[2] == "": listing.append(path[1]) else: listing = os.listdir(themePath + theme_dir) # list the files in themes/ for theme in listing: # kdialog wants 3 parameters per item. # tag is what the value is and item is what is display # not sure about status. so just putting anything there chtheme_cmd.append(theme) # one for tag chtheme_cmd.append(theme) # one for item chtheme_cmd.append("on") # one for status karamba.setMenuConfigOption(widget, "theme", 0) chtheme_pid = karamba.executeInteractive(widget, chtheme_cmd) elif key == "setProcOutformat": karamba.setMenuConfigOption(widget, "setProcOutformat", 0) procoutformat_pid = karamba.executeInteractive(widget, procoutformat_cmd) elif key == "showZero": if value == 1: print "Changing to config to show zeros." karamba.writeConfigEntry(widget, "showZero", "true") else: print "Changing to config to hide zeros." karamba.writeConfigEntry(widget, "showZero", "false") karamba.reloadTheme(widget) elif key == "setCmdJustification": karamba.setMenuConfigOption(widget, "setCmdJustification", 0) align_pid = karamba.executeInteractive(widget, align_cmd) elif key == "disableThreading": if value == 1: print "Disable threading." karamba.writeConfigEntry(widget, "disableThreading", "true") else: print "Enable threading." karamba.writeConfigEntry(widget, "disableThreading", "false") karamba.reloadTheme(widget)
def menuOptionChanged(widget, key, value): global localePid localeSelection = ["kdialog", "--title", "Country Selector", "--radiolist", "Please select your language:", "en_US", "English", "off", "de_DE", "German", "off", "es_ES", "Spanish", "off", "nl_BE", "Dutch", "off", "fr_FR", "French", "off", "fi_FI", "Finnish", "off", "it_IT", "Italian", "off"] if (key == "ac_locale"): karamba.setMenuConfigOption(widget, "ac_locale", 0) localePid = karamba.executeInteractive(widget, localeSelection)
def menuOptionChanged(widget, key, value): global themePath, theme_dir, chtheme_pid, procoutformat_pid, align_pid chtheme_pid = None procoutformat_pid = None align_pid = None chtheme_cmd = ['kdialog', '--title', 'Choose theme', '--radiolist', 'Choose theme'] align_cmd = ['kdialog', '--title', 'Set Alignment', '--radiolist', 'Set the alignment for the command text.', 'left', 'Left', 'off', 'right', 'Right', 'off', 'default','Reset to theme default', 'on'] # padding_cmd = ['kdialog', '--title', 'Set Padding', '--inputbox', 'Set maximum length for the command text. Enter an integer number. The default value for flatgray is 13', '13'] procoutformat_cmd = ['kdialog', '--title', 'Set Output format', '--inputbox', 'Set the column order for the output. Syntax is important here. Must include all columns.\n\nType \"default\" to reset to the default.\n\nDefault value is: %(cpu_percent)s %(command)s %(memory)s\n\nExamples: %(memory)s %(command)s %(cpu_percent)s\n%(command)s %(cpu_percent)s %(memory)s', '%(cpu_percent)s %(command)s %(memory)s'] if key == "theme": listing = [] if themePath[-3:] == "skz": skz_file = zipfile.ZipFile(themePath, 'r') ziplisting = skz_file.namelist() skz_file.close() for member in ziplisting: if member.find(theme_dir) > -1: path = member.split("/") if len(path) == 3 and path[2] == "": listing.append( path[1] ) else: listing = os.listdir(themePath + theme_dir) # list the files in themes/ for theme in listing: # kdialog wants 3 parameters per item. # tag is what the value is and item is what is display # not sure about status. so just putting anything there chtheme_cmd.append(theme) # one for tag chtheme_cmd.append(theme) # one for item chtheme_cmd.append("on") # one for status karamba.setMenuConfigOption(widget, "theme", 0) chtheme_pid = karamba.executeInteractive(widget, chtheme_cmd) elif key == "setProcOutformat": karamba.setMenuConfigOption(widget, "setProcOutformat", 0) procoutformat_pid = karamba.executeInteractive(widget, procoutformat_cmd) elif key == "showZero": if value == 1: print "Changing to config to show zeros." karamba.writeConfigEntry(widget, "showZero", "true") else: print "Changing to config to hide zeros." karamba.writeConfigEntry(widget, "showZero", "false") karamba.reloadTheme(widget) elif key == "setCmdJustification": karamba.setMenuConfigOption(widget, "setCmdJustification", 0) align_pid = karamba.executeInteractive(widget, align_cmd) elif key == "disableThreading": if value == 1: print "Disable threading." karamba.writeConfigEntry(widget, "disableThreading", "true") else: print "Enable threading." karamba.writeConfigEntry(widget, "disableThreading", "false") karamba.reloadTheme(widget)