def main(self, argv): # Handle arguments try: opts, args = getopt.getopt(argv, 'ic:dfl:', ['install', 'codes=', 'debug', 'force', 'log=']) except getopt.GetoptError: print 'Arguments cannot be parsed: ' + str(argv) sys.exit(2) for opt, arg in opts: if opt in ('-d', '--debug'): self.debug = True elif opt in ('-i', '--install'): self.install = True elif opt in ('-c', '--codes'): self.hwPreSelectList = arg.split(',') elif opt in ('-l', '--log'): self.logPath = arg # Initialize logging if self.debug: if self.logPath == '': self.logPath = 'ddm.log' self.log = Logger(self.logPath, 'debug', True, self.statusbar, self.window) functions.log = self.log # Set initial values self.lblText.set_text('Currently Nvidia, ATI and Broadcom drivers are supported and it detects multi-core 32-bit systems so that the PAE kernel can be installed.') # Show message that we're busy self.btnInstall.set_sensitive(False) self.btnRemove.set_sensitive(False) msg = 'Checking your hardware...' self.log.write(msg, 'ddm.main', 'info') functions.pushMessage(self.statusbar, msg) functions.repaintGui() # Fill hardware list self.fillHardware() self.btnInstall.set_sensitive(True) self.btnRemove.set_sensitive(True) # Show version number in status bar self.version = functions.getPackageVersion('device-driver-manager') functions.pushMessage(self.statusbar, self.version) # Start automatic install if self.install: self.log.write('Start automatic driver install', 'ddm.main', 'info') self.installHardware(None) # Show window and keep it on top of other windows self.window.set_keep_above(True) gtk.main()
def __init__(self): self.scriptDir = os.path.dirname(os.path.realpath(__file__)) # Load window and widgets self.builder = Gtk.Builder() self.builder.add_from_file( join(self.scriptDir, '../../share/lightdm-manager/lightdm-manager.glade')) # Main window objects go = self.builder.get_object self.window = go('ldmWindow') self.swUsers = go('swUsers') self.tvUsers = go('tvUsers') self.btnSave = go('btnSave') self.imgBackground = go('imgBackground') self.btnUsers = go('btnUsers') self.btnAppearance = go('btnAppearance') self.chkHideUsers = go('chkHideUsers') self.ebFace = go('ebFace') self.imgFace = go('imgFace') self.nbLightDM = go('nbLightDM') self.cmbThemes = go('cmbThemes') # Read from config file self.cfg = Config('lightdm-manager.conf') self.lightdmConf = self.cfg.getValue('CONFIG', 'lightdmConf') self.desktopbaseDir = self.cfg.getValue('CONFIG', 'desktopbaseDir') gktGreeterConf = self.cfg.getValue('CONFIG', 'gtkGreeterConf') kdeGreeterConf = self.cfg.getValue('CONFIG', 'kdeGreeterConf') if exists(gktGreeterConf): self.greeterConf = gktGreeterConf else: self.greeterConf = kdeGreeterConf # Translations title = _("LightDM Manager") self.window.set_title(title) self.btnUsers.set_label("_{}".format(_("Users"))) self.btnAppearance.set_label("_{}".format(_("Appearance"))) go('lblBackground').set_label(_("Background")) go('lblTheme').set_label(_("Theme")) go('lblLightDmMenu').set_label(_("Menu")) self.chkHideUsers.set_label(_("Hide users")) go('lblUsersFace').set_label(_("User icon")) go('lblUsersAutologin').set_label(_("Auto-login")) # Get current background image self.cfgGreeter = Config(self.greeterConf) try: self.curBgPath = self.cfgGreeter.getValue('greeter', 'background') self.curTheme = self.cfgGreeter.getValue('greeter', 'theme-name') except: self.curBgPath = None self.curTheme = None # Get current auto-login user self.cfgLightdm = Config(self.lightdmConf) try: self.curAutoUser = self.cfgLightdm.getValue( 'SeatDefaults', 'autologin-user').strip() self.curHideUsers = False ghu = self.cfgLightdm.getValue('SeatDefaults', 'greeter-hide-users').strip() if 'true' in ghu: self.curHideUsers = True except: self.curAutoUser = None self.curHideUsers = False # Init self.usr = User() self.newbgImg = self.curBgPath self.newAutoUser = self.curAutoUser self.newTheme = self.curTheme self.themes = [] self.selectedMenuItem = None self.debug = False self.logPath = '' self.prevPath = None self.tempFace = "/tmp/face" self.newFaces = [] self.loggedUser = functions.getUserLoginName() self.curUser = self.loggedUser self.selectImg = join(self.scriptDir, '../../share/lightdm-manager/select.png') # Handle arguments try: opts, args = getopt.getopt(sys.argv[1:], 'dl:', ['debug', 'log=']) except getopt.GetoptError: print(("Arguments cannot be parsed: %s" % str(sys.argv[1:]))) sys.exit(1) for opt, arg in opts: if opt in ('-d', '--debug'): self.debug = True elif opt in ('-l', '--log'): self.logPath = arg # Initialize logging if self.debug: if not self.logPath: self.logPath = 'lightdm-manager.log' self.log = Logger(self.logPath, 'debug', True, None, self.window) # Backup config files because ConfigParser does not preserve commented lines if not exists("%s.org" % self.greeterConf): copy(self.greeterConf, "%s.org" % self.greeterConf) self.log.write( "%(conf1)s copied to %(conf2)s.org" % { "conf1": self.greeterConf, "conf2": self.greeterConf }, 'LightDMManager.main', 'debug') if not exists("%s.org" % self.lightdmConf): copy(self.lightdmConf, "%s.org" % self.lightdmConf) self.log.write( "%(conf1)s copied to %(conf2)s.org" % { "conf1": self.lightdmConf, "conf2": self.lightdmConf }, 'LightDMManager.main', 'debug') # Initiate the treeview handler and connect the custom toggle event with usersCheckBoxToggled self.tvHandler = TreeViewHandler(self.tvUsers, self.log) self.tvHandler.connect('checkbox-toggled', self.usersCheckBoxToggled) # Get users self.users = self.usr.getUsers() self.fillUsers() self.tvHandler.selectValue(self.curUser, 1) self.setBackground(self.curBgPath) self.cmbHandlerThemes = ComboBoxHandler(self.cmbThemes) self.listThemes() self.chkHideUsers.set_active(self.curHideUsers) # Show users menu self.on_btnUsers_clicked(None) self.on_tvUsers_cursor_changed(None) self.version = functions.getPackageVersion('lightdm-manager') # Connect the signals and show the window self.builder.connect_signals(self) self.window.show()
def __init__(self): self.scriptDir = os.path.dirname(os.path.realpath(__file__)) # Load window and widgets self.builder = Gtk.Builder() self.builder.add_from_file(join(self.scriptDir, '../../share/lightdm-manager/lightdm-manager.glade')) # Main window objects go = self.builder.get_object self.window = go('ldmWindow') self.swUsers = go('swUsers') self.tvUsers = go('tvUsers') self.btnSave = go('btnSave') self.imgBackground = go('imgBackground') self.btnUsers = go('btnUsers') self.btnAppearance = go('btnAppearance') self.chkHideUsers = go('chkHideUsers') self.ebFace = go('ebFace') self.imgFace = go('imgFace') self.nbLightDM = go('nbLightDM') self.cmbThemes = go('cmbThemes') # Read from config file self.cfg = Config('lightdm-manager.conf') self.lightdmConf = self.cfg.getValue('CONFIG', 'lightdmConf') self.desktopbaseDir = self.cfg.getValue('CONFIG', 'desktopbaseDir') gktGreeterConf = self.cfg.getValue('CONFIG', 'gtkGreeterConf') kdeGreeterConf = self.cfg.getValue('CONFIG', 'kdeGreeterConf') if exists(gktGreeterConf): self.greeterConf = gktGreeterConf else: self.greeterConf = kdeGreeterConf # Translations title = _("LightDM Manager") self.window.set_title(title) self.btnUsers.set_label("_{}".format(_("Users"))) self.btnAppearance.set_label("_{}".format(_("Appearance"))) go('lblBackground').set_label(_("Background")) go('lblTheme').set_label(_("Theme")) go('lblLightDmMenu').set_label(_("Menu")) self.chkHideUsers.set_label(_("Hide users")) go('lblUsersFace').set_label(_("User icon")) go('lblUsersAutologin').set_label(_("Auto-login")) # Get current background image self.cfgGreeter = Config(self.greeterConf) try: self.curBgPath = self.cfgGreeter.getValue('greeter', 'background') self.curTheme = self.cfgGreeter.getValue('greeter', 'theme-name') except: self.curBgPath = None self.curTheme = None # Get current auto-login user self.cfgLightdm = Config(self.lightdmConf) try: self.curAutoUser = self.cfgLightdm.getValue('SeatDefaults', 'autologin-user').strip() self.curHideUsers = False ghu = self.cfgLightdm.getValue('SeatDefaults', 'greeter-hide-users').strip() if 'true' in ghu: self.curHideUsers = True except: self.curAutoUser = None self.curHideUsers = False # Init self.usr = User() self.newbgImg = self.curBgPath self.newAutoUser = self.curAutoUser self.newTheme = self.curTheme self.themes = [] self.selectedMenuItem = None self.debug = False self.logPath = '' self.prevPath = None self.tempFace = "/tmp/face" self.newFaces = [] self.loggedUser = functions.getUserLoginName() self.curUser = self.loggedUser self.selectImg = join(self.scriptDir, '../../share/lightdm-manager/select.png') # Handle arguments try: opts, args = getopt.getopt(sys.argv[1:], 'dl:', ['debug', 'log=']) except getopt.GetoptError: print(("Arguments cannot be parsed: %s" % str(sys.argv[1:]))) sys.exit(1) for opt, arg in opts: if opt in ('-d', '--debug'): self.debug = True elif opt in ('-l', '--log'): self.logPath = arg # Initialize logging if self.debug: if not self.logPath: self.logPath = 'lightdm-manager.log' self.log = Logger(self.logPath, 'debug', True, None, self.window) # Backup config files because ConfigParser does not preserve commented lines if not exists("%s.org" % self.greeterConf): copy(self.greeterConf, "%s.org" % self.greeterConf) self.log.write("%(conf1)s copied to %(conf2)s.org" % { "conf1": self.greeterConf, "conf2": self.greeterConf }, 'LightDMManager.main', 'debug') if not exists("%s.org" % self.lightdmConf): copy(self.lightdmConf, "%s.org" % self.lightdmConf) self.log.write("%(conf1)s copied to %(conf2)s.org" % { "conf1": self.lightdmConf, "conf2": self.lightdmConf }, 'LightDMManager.main', 'debug') # Initiate the treeview handler and connect the custom toggle event with usersCheckBoxToggled self.tvHandler = TreeViewHandler(self.tvUsers, self.log) self.tvHandler.connect('checkbox-toggled', self.usersCheckBoxToggled) # Get users self.users = self.usr.getUsers() self.fillUsers() self.tvHandler.selectValue(self.curUser, 1) self.setBackground(self.curBgPath) self.cmbHandlerThemes = ComboBoxHandler(self.cmbThemes) self.listThemes() self.chkHideUsers.set_active(self.curHideUsers) # Show users menu self.on_btnUsers_clicked(None) self.on_tvUsers_cursor_changed(None) self.version = functions.getPackageVersion('lightdm-manager') # Connect the signals and show the window self.builder.connect_signals(self) self.window.show()
def __init__(self): self.scriptDir = abspath(dirname(__file__)) self.shareDir = join(self.scriptDir, '../../../share/solydxk/constructor') self.userAppDir = join(get_user_home_dir(), ".constructor") self.distroFile = join(self.userAppDir, "distros.list") # Create the user's application directory if it doesn't exist if not isdir(self.userAppDir): user_name = getUserLoginName() makedirs(self.userAppDir) old_distro_file = join(self.scriptDir, "distros.list") if exists(old_distro_file): move(old_distro_file, self.distroFile) system("chown -R %s:%s %s" % (user_name, user_name, self.userAppDir)) # Load window and widgets self.builder = Gtk.Builder() self.builder.add_from_file(join(self.shareDir, 'constructor.glade')) # Main window objects go = self.builder.get_object self.window = go('constructorWindow') self.tvDistros = go('tvDistros') self.lblOutput = go('lblOutput') self.statusbar = go('statusbar') self.btnAdd = go('btnAdd') self.chkSelectAll = go('chkSelectAll') self.btnRemove = go('btnRemove') self.btnEdit = go('btnEdit') self.btnUpgrade = go('btnUpgrade') self.btnLocalize = go('btnLocalize') self.btnBuildIso = go('btnBuildIso') # Add iso window objects self.windowAddDistro = go('addDistroWindow') self.txtIso = go('txtIso') self.txtDir = go('txtDir') self.btnDir = go('btnDir') self.btnSave = go('btnSave') self.btnHelp = go('btnHelp') self.lblIso = go('lblIso') self.boxIso = go('boxIso') self.lblDir = go('lblDir') self.chkFromIso = go('chkFromIso') # Main window translations self.window.set_title(_("SolydXK Constructor")) self.chkSelectAll.set_label(_("Select all")) self.btnAdd.set_label("_{}".format(_("Add"))) self.btnRemove.set_label("_{}".format(_("Remove"))) self.btnEdit.set_label("_{}".format(_("Edit"))) self.btnUpgrade.set_label("_{}".format(_("Upgrade"))) self.btnLocalize.set_label("_{}".format(_("Localize"))) self.btnBuildIso.set_label("_{}".format(_("Build"))) self.btnHelp.set_label("_{}".format(_("Help"))) # Add iso window translations self.windowAddDistro.set_title(_("Add Distribution")) self.lblIso.set_text(_("ISO")) go('lblFromIso').set_label("Create from ISO") go('btnCancel').set_label("_{}".format(_("Cancel"))) # Init self.ec = ExecCmd() self.ec.run("modprobe loop", False) self.queue = Queue() self.mountDir = "/mnt/constructor" self.distroAdded = False self.iso = None self.dir = None self.isoName = None self.doneWav = join(self.shareDir, 'done.wav') self.htmlDir = join(self.shareDir, "html") self.help = join(self.get_language_dir(), "help.html") self.chkFromIso.set_active(True) self.toggleGuiElements(False) # Treeviews self.tvHandlerDistros = TreeViewHandler(self.tvDistros) self.fillTreeViewDistros() # Version information ver = _("Version") self.version = "%s: %s" % (ver, getPackageVersion('solydxk-constructor')) self.showOutput(self.version) # Connect the signals and show the window self.builder.connect_signals(self) self.window.show()
def __init__(self): self.scriptDir = abspath(dirname(__file__)) self.shareDir = join(self.scriptDir, '../../../share/solydxk/constructor') # Load window and widgets self.builder = Gtk.Builder() self.builder.add_from_file(join(self.shareDir, 'constructor.glade')) # Main window objects go = self.builder.get_object self.window = go('constructorWindow') self.tvDistros = go('tvDistros') self.lblOutput = go('lblOutput') self.statusbar = go('statusbar') self.btnAdd = go('btnAdd') self.chkSelectAll = go('chkSelectAll') self.btnRemove = go('btnRemove') self.btnEdit = go('btnEdit') self.btnUpgrade = go('btnUpgrade') self.btnLocalize = go('btnLocalize') self.btnBuildIso = go('btnBuildIso') # Add iso window objects self.windowAddDistro = go('addDistroWindow') self.txtIso = go('txtIso') self.txtDir = go('txtDir') self.btnDir = go('btnDir') self.btnSave = go('btnSave') self.btnHelp = go('btnHelp') self.lblIso = go('lblIso') self.boxIso = go('boxIso') self.lblDir = go('lblDir') self.chkFromIso = go('chkFromIso') # Main window translations self.window.set_title(_("SolydXK Constructor")) self.chkSelectAll.set_label(_("Select all")) self.btnAdd.set_label("_{}".format(_("Add"))) self.btnRemove.set_label("_{}".format(_("Remove"))) self.btnEdit.set_label("_{}".format(_("Edit"))) self.btnUpgrade.set_label("_{}".format(_("Upgrade"))) self.btnLocalize.set_label("_{}".format(_("Localize"))) self.btnBuildIso.set_label("_{}".format(_("Build"))) self.btnHelp.set_label("_{}".format(_("Help"))) # Add iso window translations self.lblIso.set_text(_("ISO")) go('btnCancel').set_label("_{}".format(_("Cancel"))) # Init self.ec = ExecCmd() self.ec.run("modprobe loop", False) self.queue = Queue() self.mountDir = "/mnt/constructor" self.distroFile = join(self.scriptDir, "distros.list") self.distroAdded = False self.iso = None self.dir = None self.isoName = None self.doneWav = join(self.shareDir, 'done.wav') self.help = join(self.shareDir, 'help.html') self.chkFromIso.set_active(True) self.toggleGuiElements(False) self.hostEfiArchitecture = functions.getHostEfiArchitecture() # Treeviews self.tvHandlerDistros = TreeViewHandler(self.tvDistros) self.fillTreeViewDistros() # Version information ver = _("Version") self.version = "%s: %s" % (ver, functions.getPackageVersion('solydxk-constructor')) self.showOutput(self.version) # Connect the signals and show the window self.builder.connect_signals(self) self.window.show()
# Initialize logging logFile = '' if debug: logFile = 'ddm.log' log = Logger(logFile) functions.log = log if debug: if os.path.isfile(log.logPath): open(log.logPath, 'w').close() log.write('Write debug information to file: ' + log.logPath, 'main', 'info') # Log some basic environmental information machineInfo = functions.getSystemVersionInfo() log.write('Machine info: ' + machineInfo, 'main', 'info') version = functions.getPackageVersion('device-driver-manager') log.write('DDM version: ' + version, 'main', 'info') # There were issues with apt-listbugs # Warn the user for any errors that might accur when apt-listbugs is installed if functions.isPackageInstalled('apt-listbugs'): log.write('apt-listbugs is installed and might interfere with driver installation', 'main', 'warning') # Set variables scriptDir = os.path.dirname(os.path.realpath(__file__)) # Pass arguments to ddm.py: replace - with : -> because kdesudo assumes these options are meant for him... # TODO: Isn't there another way? args = ' '.join(sys.argv[1:]) if len(args) > 0: args = ' ' + string.replace(args, '-', ':')
def __init__(self): self.scriptDir = abspath(dirname(__file__)) # Load window and widgets self.builder = Gtk.Builder() self.builder.add_from_file(join(self.scriptDir, '../../../share/solydxk/conky/conky.glade')) go = self.builder.get_object self.window = go('conkyWindow') self.ebTitle = go('ebTitle') self.lblTitle = go('lblTitle') self.lblMenuTitle = go('lblMenuTitle') self.statusbar = go('statusbar') self.ebMenu = go('ebMenu') self.ebMenuPreferences = go('ebMenuPreferences') self.lblMenuPreferences = go('lblMenuPreferences') self.ebMenuNetwork = go('ebMenuNetwork') self.lblMenuNetwork = go('lblMenuNetwork') self.ebMenuSystem = go('ebMenuSystem') self.lblMenuSystem = go('lblMenuSystem') self.nbConky = go('nbConky') self.btnSave = go('btnSave') # Preferences objects self.lblPrefAction = go('lblPrefAction') self.cmbPrefAction = go('cmbPrefAction') self.lsAction = go('lsAction') self.btnPrefActionApply = go('btnPrefActionApply') self.lblPrefAutostart = go('lblPrefAutostart') self.chkPrefAutostart = go('chkPrefAutostart') self.lblPrefAutostartText = go('lblPrefAutostartText') self.lblPrefSleep = go('lblPrefSleep') self.cmbPrefSleep = go('cmbPrefSleep') self.lsSleep = go('lsSleep') self.lblPrefSleepText = go('lblPrefSleepText') self.lblPrefAlign = go('lblPrefAlign') self.cmbPrefAlign = go('cmbPrefAlign') self.lsAlign = go('lsAlign') self.lblPrefAlignText = go('lblPrefAlignText') # Network objects self.lblNetwInterface = go('lblNetwInterface') self.txtNetwInterface = go('txtNetwInterface') self.lblNetwInterfaceText = go('lblNetwInterfaceText') self.lblNetwDownSpeed = go('lblNetwDownSpeed') self.txtNetwDownSpeed = go('txtNetwDownSpeed') self.lblNetwSpeedText = go('lblNetwSpeedText') self.lblNetwUpSpeed = go('lblNetwUpSpeed') self.txtNetwUpSpeed = go('txtNetwUpSpeed') self.btnNetspeed = go('btnNetspeed') self.lblNetwLanIP = go('lblNetwLanIP') self.chkNetwLanIP = go('chkNetwLanIP') self.lblNetwLanIPText = go('lblNetwLanIPText') self.lblNetwIP = go('lblNetwIP') self.chkNetwIP = go('chkNetwIP') # System objects self.lblSysCoresTemp = go('lblSysCoresTemp') self.chkSysCores = go('chkSysCores') self.lblSysCoresTempText = go('lblSysCoresTempText') self.lblSysHdTemp = go('lblSysHdTemp') self.chkSysHd = go('chkSysHd') self.lblSysTempUnit = go('lblSysTempUnit') self.cmbSysTempUnit = go('cmbSysTempUnit') self.lsTemp = go('lsTemp') self.lblSysCpuFan = go('lblSysCpuFan') self.chkSysCpuFan = go('chkSysCpuFan') self.lblSysChassisFan = go('lblSysChassisFan') self.chkSysChassisFan = go('chkSysChassisFan') self.lblSysKernel = go('lblSysKernel') self.chkSysKernel = go('chkSysKernel') self.lblSysUP = go('lblSysUP') self.chkSysUP = go('chkSysUP') # Read from config file self.cfg = Config(join(self.scriptDir, 'conky.conf')) self.clrTitleFg = Gdk.color_parse(self.cfg.getValue('COLORS', 'title_fg')) self.clrTitleBg = Gdk.color_parse(self.cfg.getValue('COLORS', 'title_bg')) self.clrMenuSelect = Gdk.color_parse(self.cfg.getValue('COLORS', 'menu_select')) self.clrMenuHover = Gdk.color_parse(self.cfg.getValue('COLORS', 'menu_hover')) self.clrMenuBg = Gdk.color_parse(self.cfg.getValue('COLORS', 'menu_bg')) # Set background and forground colors self.ebTitle.modify_bg(Gtk.StateType.NORMAL, self.clrTitleBg) self.lblTitle.modify_fg(Gtk.StateType.NORMAL, self.clrTitleFg) self.lblMenuPreferences.modify_fg(Gtk.StateType.NORMAL, self.clrTitleBg) self.lblMenuNetwork.modify_fg(Gtk.StateType.NORMAL, self.clrTitleBg) self.lblMenuSystem.modify_fg(Gtk.StateType.NORMAL, self.clrTitleBg) self.lblMenuTitle.modify_fg(Gtk.StateType.NORMAL, self.clrTitleBg) self.ebMenu.modify_bg(Gtk.StateType.NORMAL, self.clrMenuBg) self.ebMenuPreferences.modify_bg(Gtk.StateType.NORMAL, self.clrMenuBg) self.ebMenuNetwork.modify_bg(Gtk.StateType.NORMAL, self.clrMenuBg) self.ebMenuSystem.modify_bg(Gtk.StateType.NORMAL, self.clrMenuBg) # Translations self.window.set_title(_("SolydXK Conky")) self.lblTitle.set_text(self.window.get_title()) self.lblMenuPreferences.set_text(_("Preferences")) self.lblMenuNetwork.set_text(_("Network")) self.lblMenuSystem.set_text(_("System")) self.btnSave.set_label(_("Save")) self.lblPrefAction.set_text(_("Action")) self.btnPrefActionApply.set_label(_("Apply")) self.lblPrefAutostart.set_text(_("Autostart")) self.lblPrefAutostartText.set_text(_("Autostart Conky on login.")) self.lblPrefSleep.set_text(_("Sleep")) self.lblPrefSleepText.set_text(_("Seconds to wait before starting Conky.\nDefault is 20 seconds.")) self.lblPrefAlign.set_text(_("Align")) self.lblPrefAlignText.set_text(_("Conky alignment on the desktop.")) self.lblNetwInterface.set_text(_("Interface")) self.lblNetwInterfaceText.set_text(_("Auto detected (use ifconfig).")) self.lblNetwDownSpeed.set_text(_("Download speed")) self.lblNetwSpeedText.set_text(_("Test your download and upload speed\nwith speed.net (in Kilobytes).")) self.lblNetwUpSpeed.set_text(_("Upload speed")) self.btnNetspeed.set_label(_("speedtest.net")) self.lblNetwLanIP.set_text(_("LAN IP")) self.lblNetwLanIPText.set_text(_("Check to show these items.")) self.lblNetwIP.set_text(_("IP")) self.lblSysCoresTemp.set_text(_("Core temperature")) self.lblSysCoresTempText.set_text(_("Check to show these items.")) self.lblSysHdTemp.set_text(_("HD temperature")) self.lblSysTempUnit.set_text(_("Temperature unit")) self.lblSysCpuFan.set_text(_("CPU fan speed")) self.lblSysChassisFan.set_text(_("Chassis fan speed")) self.lblSysKernel.set_text(_("Kernel")) self.lblSysUP.set_text(_("Update Pack")) # Fill combos actions = [[_("Start")], [_("Stop")], [_("Remove")]] for a in actions: self.lsAction.append(a) self.sleep = [[0], [10], [20], [30], [40], [50], [60]] for s in self.sleep: self.lsSleep.append(s) align = [[_("Right")], [_("Left")]] for a in align: self.lsAlign.append(a) temperature = [[_("Celsius")], [_("Fahrenheit")]] for t in temperature: self.lsTemp.append(t) # Initialize logging self.log = Logger('', 'debug', True, self.statusbar) # Get command lines self.commandCore = self.cfg.getValue('COMMANDS', 'core') self.commandCpu = self.cfg.getValue('COMMANDS', 'cpu') self.commandChassis = self.cfg.getValue('COMMANDS', 'chassis') self.commandHdd = self.cfg.getValue('COMMANDS', 'hdd') self.commandLanIp = self.cfg.getValue('COMMANDS', 'lanip') self.commandIp = self.cfg.getValue('COMMANDS', 'ip') self.commandKernel = self.cfg.getValue('COMMANDS', 'kernel') self.commandUp = self.cfg.getValue('COMMANDS', 'up') # Init variables self.ec = ExecCmd(self.log) self.selectedMenuItem = None self.defaultSpeed = '1000' self.home = expanduser("~/") self.dist = functions.getDistribution(False) self.luaDir = join(self.home, '.lua/scripts') self.lua = join(self.luaDir, 'clock_rings.lua') self.conkyrc = join(self.home, '.conkyrc') self.conkyStart = join(self.home, '.conky-start') self.autostartDir = join(self.home, '.config/autostart') self.desktop = join(self.autostartDir, 'conky.desktop') # Get current settings self.getSettings() # Show version number in status bar self.version = functions.getPackageVersion('solydxk-conky') functions.pushMessage(self.statusbar, self.version) # Show preferences at startup self.on_ebMenuPreferences_button_release_event() self.builder.connect_signals(self) self.window.show()
def __init__(self): self.scriptDir = abspath(dirname(__file__)) self.shareDir = join(self.scriptDir, '../../../share/trail/constructor') self.userAppDir = join(get_user_home_dir(), ".constructor") self.distroFile = join(self.userAppDir, "distros.list") # Create the user's application directory if it doesn't exist if not isdir(self.userAppDir): user_name = getUserLoginName() makedirs(self.userAppDir) old_distro_file = join(self.scriptDir, "distros.list") if exists(old_distro_file): move(old_distro_file, self.distroFile) system("chown -R %s:%s %s" % (user_name, user_name, self.userAppDir)) # Load window and widgets self.builder = Gtk.Builder() self.builder.add_from_file(join(self.shareDir, 'constructor.glade')) # Main window objects go = self.builder.get_object self.window = go('constructorWindow') self.tvDistros = go('tvDistros') self.lblOutput = go('lblOutput') self.statusbar = go('statusbar') self.btnAdd = go('btnAdd') self.chkSelectAll = go('chkSelectAll') self.btnRemove = go('btnRemove') self.btnEdit = go('btnEdit') self.btnUpgrade = go('btnUpgrade') self.btnLocalize = go('btnLocalize') self.btnBuildIso = go('btnBuildIso') # Add iso window objects self.windowAddDistro = go('addDistroWindow') self.txtIso = go('txtIso') self.txtDir = go('txtDir') self.btnDir = go('btnDir') self.btnSave = go('btnSave') self.lblIso = go('lblIso') self.boxIso = go('boxIso') self.lblDir = go('lblDir') self.chkFromIso = go('chkFromIso') # Main window translations self.window.set_title(_("Constructor")) self.chkSelectAll.set_label(_("Select all")) self.btnAdd.set_label("_{}".format(_("Add"))) self.btnRemove.set_label("_{}".format(_("Remove"))) self.btnEdit.set_label("_{}".format(_("Edit"))) self.btnUpgrade.set_label("_{}".format(_("Upgrade"))) self.btnLocalize.set_label("_{}".format(_("Localize"))) self.btnBuildIso.set_label("_{}".format(_("Build"))) # Add iso window translations self.lblIso.set_text(_("ISO")) go('btnCancel').set_label("_{}".format(_("Cancel"))) # Init self.ec = ExecCmd() self.ec.run("modprobe loop", False) self.queue = Queue() self.mountDir = "/mnt/constructor" self.distroAdded = False self.iso = None self.dir = None self.isoName = None self.chkFromIso.set_active(True) self.toggleGuiElements(False) # Treeviews self.tvHandlerDistros = TreeViewHandler(self.tvDistros) self.fillTreeViewDistros() # Version information ver = _("Version") self.version = "%s: %s" % (ver, getPackageVersion('constructor')) self.showOutput(self.version) # Connect the signals and show the window self.builder.connect_signals(self) self.window.show()
def __init__(self): self.scriptDir = abspath(dirname(__file__)) # Load window and widgets self.builder = Gtk.Builder() self.builder.add_from_file(join(self.scriptDir, '../../../share/solydxk/conky/conky.glade')) go = self.builder.get_object self.window = go('conkyWindow') self.lblMenuTitle = go('lblMenuTitle') self.statusbar = go('statusbar') self.btnPreferences = go('btnPreferences') self.btnNetwork = go('btnNetwork') self.btnSystem = go('btnSystem') self.btnColors = go('btnColors') self.nbConky = go('nbConky') self.btnSave = go('btnSave') # Preferences objects self.lblPrefAction = go('lblPrefAction') self.cmbPrefAction = go('cmbPrefAction') self.lsAction = go('lsAction') self.btnPrefActionApply = go('btnPrefActionApply') self.lblPrefAutostart = go('lblPrefAutostart') self.chkPrefAutostart = go('chkPrefAutostart') self.lblPrefAutostartText = go('lblPrefAutostartText') self.lblPrefSleep = go('lblPrefSleep') self.cmbPrefSleep = go('cmbPrefSleep') self.lsSleep = go('lsSleep') self.lblPrefSleepText = go('lblPrefSleepText') self.lblPrefAlign = go('lblPrefAlign') self.cmbPrefAlign = go('cmbPrefAlign') self.lsAlign = go('lsAlign') self.lblPrefAlignText = go('lblPrefAlignText') # Network objects self.lblNetwInterface = go('lblNetwInterface') self.txtNetwInterface = go('txtNetwInterface') self.lblNetwInterfaceText = go('lblNetwInterfaceText') self.lblNetwDownSpeed = go('lblNetwDownSpeed') self.txtNetwDownSpeed = go('txtNetwDownSpeed') self.lblNetwSpeedText = go('lblNetwSpeedText') self.lblNetwUpSpeed = go('lblNetwUpSpeed') self.txtNetwUpSpeed = go('txtNetwUpSpeed') self.btnNetspeed = go('btnNetspeed') self.lblNetwLanIP = go('lblNetwLanIP') self.chkNetwLanIP = go('chkNetwLanIP') self.lblNetwLanIPText = go('lblNetwLanIPText') self.lblNetwIP = go('lblNetwIP') self.chkNetwIP = go('chkNetwIP') # System objects self.lblSysCoresTemp = go('lblSysCoresTemp') self.chkSysCores = go('chkSysCores') self.lblSysCoresTempText = go('lblSysCoresTempText') self.lblSysHdTemp = go('lblSysHdTemp') self.chkSysHd = go('chkSysHd') self.lblSysTempUnit = go('lblSysTempUnit') self.cmbSysTempUnit = go('cmbSysTempUnit') self.lsTemp = go('lsTemp') self.lblSysCpuFan = go('lblSysCpuFan') self.chkSysCpuFan = go('chkSysCpuFan') self.lblSysChassisFan = go('lblSysChassisFan') self.chkSysChassisFan = go('chkSysChassisFan') self.lblSysKernel = go('lblSysKernel') self.chkSysKernel = go('chkSysKernel') # Color objects self.colorchooser = go('colorchooserDialog') self.lblDateTitle = go('lblDateTitle') self.lblDayClock = go('lblDayClock') self.lblSystemInfo = go('lblSystemInfo') self.colorBtnDateTitle = go('colorBtnDateTitle') self.colorBtnDayClock = go('colorBtnDayClock') self.colorBtnSystemInfo = go('colorBtnSystemInfo') self.dateTitleColor = None self.dayClockColor = None self.systemInfoColor = None self.dateTitleColorNew = None self.dayClockColorNew = None self.systemInfoColorNew = None # Translations self.window.set_title(_("SolydXK Conky")) self.btnPreferences.set_label(_("Preferences")) self.btnNetwork.set_label(_("Network")) self.btnSystem.set_label(_("System")) self.btnColors.set_label(_("Colors")) self.btnSave.set_label(_("Save")) self.lblPrefAction.set_label(_("Action")) self.btnPrefActionApply.set_label(_("Apply")) self.lblPrefAutostart.set_label(_("Autostart")) self.lblPrefAutostartText.set_label(_("Autostart Conky on login.")) self.lblPrefSleep.set_label(_("Sleep")) self.lblPrefSleepText.set_label(_("Seconds to wait before starting Conky.\nDefault is 20 seconds.")) self.lblPrefAlign.set_label(_("Align")) self.lblPrefAlignText.set_label(_("Conky alignment on the desktop.")) self.lblNetwInterface.set_label(_("Interface")) self.lblNetwInterfaceText.set_label(_("Auto detected (use ifconfig).")) self.lblNetwDownSpeed.set_label(_("Download speed")) self.lblNetwSpeedText.set_label(_("Test your download and upload speed\nwith speedtest.net (in Kilobytes).")) self.lblNetwUpSpeed.set_label(_("Upload speed")) self.btnNetspeed.set_label("speedtest.net") self.lblNetwLanIP.set_label(_("LAN IP")) self.lblNetwLanIPText.set_label(_("Check to show these items.")) self.lblNetwIP.set_label(_("IP")) self.lblSysCoresTemp.set_label(_("Core temperature")) self.lblSysCoresTempText.set_label(_("Check to show these items.")) self.lblSysHdTemp.set_label(_("HD temperature")) self.lblSysTempUnit.set_label(_("Temperature unit")) self.lblSysCpuFan.set_label(_("CPU fan speed")) self.lblSysChassisFan.set_label(_("Chassis fan speed")) self.lblSysKernel.set_label(_("Kernel")) self.lblDateTitle.set_label(_("Date and title")) self.lblDayClock.set_label(_("Day and clock")) self.lblSystemInfo.set_label(_("System information")) self.corelbl = _("Core temp") self.cpulbl = _("CPU fan") self.chassislbl = _("Chassis fan") self.hdlbl = _("HD temp") self.lanlbl = _("LAN IP") self.iplbl = _("IP") self.kernellbl = _("Kernel") reset = _("Reset") go('btnResetDateTitle').set_label(reset) go('btnResetDayClock').set_label(reset) go('btnResetSystemInfo').set_label(reset) # Fill combos actions = [[_("Start")], [_("Stop")], [_("Remove")]] for a in actions: self.lsAction.append(a) self.sleep = [[0], [10], [20], [30], [40], [50], [60]] for s in self.sleep: self.lsSleep.append(s) align = [[_("Right")], [_("Left")]] for a in align: self.lsAlign.append(a) temperature = [[_("Celsius")], [_("Fahrenheit")]] for t in temperature: self.lsTemp.append(t) # Initialize logging self.log = Logger('', 'debug', True, self.statusbar) # Get distribution specific settings self.dist = functions.getDistribution(False).lower() conf_path = join(self.scriptDir, 'cfg/conky-k.conf') self.conkyrc_template = join(self.scriptDir, 'cfg/conkyrc-k') self.lua_template = join(self.scriptDir, 'cfg/clock_rings-k.lua') self.dateTitleColorDefault = DATE_TITLE_K.upper() self.dayClockColorDefault = DAY_CLOCK_K.upper() self.systemInfoColorDefault = SYS_INFO_K.upper() if 'solydx' in self.dist: conf_path = join(self.scriptDir, 'cfg/conky-x.conf') self.conkyrc_template = join(self.scriptDir, 'cfg/conkyrc-x') self.lua_template = join(self.scriptDir, 'cfg/clock_rings-x.lua') self.dateTitleColorDefault = DATE_TITLE_X.upper() self.dayClockColorDefault = DAY_CLOCK_X.upper() self.systemInfoColorDefault = SYS_INFO_X.upper() # Read from config file self.cfg = Config(conf_path) self.commandCore = self.cfg.getValue('COMMANDS', 'core') self.commandCpu = self.cfg.getValue('COMMANDS', 'cpu') self.commandChassis = self.cfg.getValue('COMMANDS', 'chassis') self.commandHdd = self.cfg.getValue('COMMANDS', 'hdd') self.commandLanIp = self.cfg.getValue('COMMANDS', 'lanip') self.commandIp = self.cfg.getValue('COMMANDS', 'ip') self.commandKernel = self.cfg.getValue('COMMANDS', 'kernel') # Init variables self.ec = ExecCmd(self.log) self.selectedMenuItem = None self.defaultSpeed = '1000' self.home = expanduser("~/") self.luaDir = join(self.home, '.lua/scripts') self.lua = join(self.luaDir, 'clock_rings.lua') self.conkyrc = join(self.home, '.conkyrc') self.conkyStart = join(self.home, '.conky-start') self.autostartDir = join(self.home, '.config/autostart') self.desktop = join(self.autostartDir, 'conky.desktop') # Get current settings self.getSettings() # Show version number in status bar self.version = functions.getPackageVersion('solydxk-conky') functions.pushMessage(self.statusbar, self.version) # Show preferences at startup self.on_btnPreferences_clicked() self.builder.connect_signals(self) self.window.show()