def __init__(self, hwCodesWithStatusList, loggerObject): threading.Thread.__init__(self) self.log = loggerObject self.log.write('Initialize DriverRemove', 'drivers.DriverRemove', 'debug') self.hwCodesWithStatusList = hwCodesWithStatusList self.distribution = functions.getDistribution()
def __init__(self, hwCodesWithStatusList, loggerObject): threading.Thread.__init__(self) self.log = loggerObject self.hwCodesWithStatusList = hwCodesWithStatusList self.distribution = functions.getDistribution()
def __init__(self, loggerObject): self.log = loggerObject self.log.write('Initialize DriverCheck', 'drivers.DriverCheck', 'debug') self.distribution = functions.getDistribution()
def __init__(self, loggerObject): self.log = loggerObject self.distribution = functions.getDistribution()
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, '-', ':') # Pass the log path to ddm.py if debug: args += ' :l ' + log.logPath if not functions.getDistribution() == '': # Do not run in live environment if not functions.isRunningLive() or force: ddmPath = os.path.join(scriptDir, 'ddm.py' + args) # Add launcher string, only when not root launcher = '' if os.geteuid() > 0: launcher = 'gksu --message "<b>Please enter your password</b>"' if os.path.exists('/usr/bin/kdesudo'): launcher = 'kdesudo -i /usr/share/device-driver-manager/logo.png -d --comment "<b>Please enter your password</b>"' cmd = '%s python %s' % (launcher, ddmPath) log.write('Startup command: ' + cmd, 'main', 'debug') os.system(cmd) else:
for j, voxel in enumerate(ROIMap): #print 'something' indices[j] = np.where((originalVoxelCoordinates == voxel).all( axis=1) == 1)[0][0] ROIIndices.append(indices) spatialConsistencies = functions.calculateSpatialConsistencyInParallel( ROIIndices, allVoxelTs) spatialConsistencyData = { 'spatialConsistencies': spatialConsistencies, 'type': 'optimized' } savePath = subject + optimizedConsistencySaveName with open(savePath, 'wb') as f: pickle.dump(spatialConsistencyData, f, -1) consistencyDistribution, consistencyBinCenters = functions.getDistribution( spatialConsistencies, params.nConsistencyBins) correlationsToCentroid = functions.calculateCorrelationsToCentroidInParallel( ROIIndices, allVoxelTs, centroidIndices) correlationData = { 'correlationsToCentroid': correlationsToCentroid, 'type': 'optimized' } savePath = subject + optimizedCorrelationSaveName with open(savePath, 'wb') as f: pickle.dump(correlationData, f, -1) correlationDistribution, correlationBinCenters = functions.getDistribution( correlationsToCentroid, params.nConsistencyBins) if i == 0: ax1.plot(consistencyBinCenters,
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__)) # 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()