mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 07:57:19 +00:00
intermediate commit
This commit is contained in:
parent
0fdb7317cc
commit
ce74cdb2d5
@ -1,6 +1,8 @@
|
|||||||
Ver.1.7.3:
|
Ver.1.7.3:
|
||||||
+ added readme directory
|
+ added readme directory
|
||||||
- fix tooltip for custom uptime format
|
- fix tooltip for custom uptime format
|
||||||
|
- fix #12
|
||||||
|
* more refactoring to the god of refactoring
|
||||||
|
|
||||||
Ver.1.7.2:
|
Ver.1.7.2:
|
||||||
+ added tags $dd, $d, $hh, $h, $mm, $m to custom uptime format
|
+ added tags $dd, $d, $hh, $h, $mm, $m to custom uptime format
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
Вер.1.7.3:
|
Вер.1.7.3:
|
||||||
+ добавлена директория readme
|
+ добавлена директория readme
|
||||||
- фикс подсказки для кастомного формата аптайма
|
- фикс подсказки для кастомного формата аптайма
|
||||||
|
- фикс #12
|
||||||
|
* больше рефакторинга богу рефакторинга
|
||||||
|
|
||||||
Вер.1.7.2:
|
Вер.1.7.2:
|
||||||
+ добавлены тэги $dd, $d, $hh, $h, $mm, $m в кастомный формат аптайма
|
+ добавлены тэги $dd, $d, $hh, $h, $mm, $m в кастомный формат аптайма
|
||||||
|
@ -27,8 +27,10 @@ class Config():
|
|||||||
self.applet = applet
|
self.applet = applet
|
||||||
self.config = self.applet.config()
|
self.config = self.applet.config()
|
||||||
|
|
||||||
|
|
||||||
def get(self, key, default = ''):
|
def get(self, key, default = ''):
|
||||||
return self.config.readEntry(key, default).toString()
|
return self.config.readEntry(key, default).toString()
|
||||||
|
|
||||||
|
|
||||||
def set(self, key, value):
|
def set(self, key, value):
|
||||||
self.config.writeEntry(key, value)
|
self.config.writeEntry(key, value)
|
||||||
|
@ -27,10 +27,11 @@ import config
|
|||||||
|
|
||||||
|
|
||||||
class ConfigDefinition:
|
class ConfigDefinition:
|
||||||
def __init__(self, parent, configpage):
|
def __init__(self, parent, configpage, defaults):
|
||||||
"""class definition"""
|
"""class definition"""
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.configpage = configpage
|
self.configpage = configpage
|
||||||
|
self.defaults = defaults
|
||||||
|
|
||||||
|
|
||||||
def configAccepted(self):
|
def configAccepted(self):
|
||||||
@ -68,7 +69,7 @@ class ConfigDefinition:
|
|||||||
|
|
||||||
settings.set('tooltip_num', self.configpage.ui.spinBox_tooltipNum.value())
|
settings.set('tooltip_num', self.configpage.ui.spinBox_tooltipNum.value())
|
||||||
for label in ['cpu', 'cpuclock', 'mem', 'swap', 'down', 'up']:
|
for label in ['cpu', 'cpuclock', 'mem', 'swap', 'down', 'up']:
|
||||||
exec('settings.set("' + label + '_color", str(self.configpage.kcolorcombo_' + label + '.color().name()))')
|
settings.set(self.defaults['confColor'][label], str(self.configpage.kcolorcombos[label].color().name()))
|
||||||
|
|
||||||
dataengineConfig = unicode(KGlobal.dirs().localkdedir()) + "/share/config/extsysmon.conf"
|
dataengineConfig = unicode(KGlobal.dirs().localkdedir()) + "/share/config/extsysmon.conf"
|
||||||
try:
|
try:
|
||||||
@ -263,12 +264,13 @@ class ConfigDefinition:
|
|||||||
self.configpage.ui.spinBox_mpdport.setValue(int(deSettings['MPDPORT']))
|
self.configpage.ui.spinBox_mpdport.setValue(int(deSettings['MPDPORT']))
|
||||||
self.configpage.ui.lineEdit_customCommand.setText(deSettings['CUSTOM'])
|
self.configpage.ui.lineEdit_customCommand.setText(deSettings['CUSTOM'])
|
||||||
|
|
||||||
for label in self.parent.dict_orders.keys():
|
label_order = str(settings.get('label_order', '1345'))
|
||||||
exec ('bool = self.parent.' + self.parent.dict_orders[label] + 'Bool')
|
for label in self.defaults['order'].keys():
|
||||||
self.configpage.checkboxes[self.parent.dict_orders[label]].setCheckState(bool)
|
bool = self.defaults['confBool'][self.defaults['order'][label]]
|
||||||
|
self.configpage.checkboxes[self.defaults['order'][label]].setCheckState(bool)
|
||||||
if (bool > 0):
|
if (bool > 0):
|
||||||
self.configpage.sliders[self.parent.dict_orders[label]].setValue(self.parent.label_order.find(label)+1)
|
self.configpage.sliders[self.defaults['order'][label]].setValue(label_order.find(label)+1)
|
||||||
self.configpage.lineedits[self.parent.dict_orders[label]].setText(str(settings.get(self.parent.dict_orders[label] + 'Format', self.parent.dict_defFormat[self.parent.dict_orders[label]])))
|
self.configpage.lineedits[self.defaults['order'][label]].setText(str(settings.get(self.defaults['confFormat'][label], self.defaults['format'][label])))
|
||||||
|
|
||||||
# add config page
|
# add config page
|
||||||
page = parent.addPage(self.configpage, i18n(self.parent.name()))
|
page = parent.addPage(self.configpage, i18n(self.parent.name()))
|
||||||
|
@ -30,30 +30,34 @@ class ConfigWindow(QWidget):
|
|||||||
QWidget.__init__(self)
|
QWidget.__init__(self)
|
||||||
self.ui = uic.loadUi(parent.package().filePath('ui', 'configwindow.ui'), self)
|
self.ui = uic.loadUi(parent.package().filePath('ui', 'configwindow.ui'), self)
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
self.kcolorcombos = {'cpu':self.ui.kcolorcombo_cpu,
|
||||||
|
'cpuclock':self.ui.kcolorcombo_cpuclock, 'down':self.ui.kcolorcombo_down,
|
||||||
|
'mem':self.ui.kcolorcombo_mem, 'swap':self.ui.kcolorcombo_swap,
|
||||||
|
'up':self.ui.kcolorcombo_up}
|
||||||
self.checkboxes = {'bat':self.ui.checkBox_bat, 'cpu':self.ui.checkBox_cpu,
|
self.checkboxes = {'bat':self.ui.checkBox_bat, 'cpu':self.ui.checkBox_cpu,
|
||||||
'cpuclock':self.ui.checkBox_cpuclock, 'gpu':self.ui.checkBox_gpu,
|
'cpuclock':self.ui.checkBox_cpuclock, 'custom':self.ui.checkBox_custom,
|
||||||
'gputemp':self.ui.checkBox_gpuTemp, 'hdd':self.ui.checkBox_hdd,
|
'gpu':self.ui.checkBox_gpu, 'gputemp':self.ui.checkBox_gpuTemp,
|
||||||
'hddtemp':self.ui.checkBox_hddTemp, 'mem':self.ui.checkBox_mem,
|
'hdd':self.ui.checkBox_hdd, 'hddtemp':self.ui.checkBox_hddTemp,
|
||||||
'net':self.ui.checkBox_net, 'swap':self.ui.checkBox_swap,
|
'mem':self.ui.checkBox_mem, 'net':self.ui.checkBox_net,
|
||||||
'temp':self.ui.checkBox_temp, 'uptime':self.ui.checkBox_uptime,
|
'swap':self.ui.checkBox_swap, 'temp':self.ui.checkBox_temp,
|
||||||
'player':self.ui.checkBox_player, 'time':self.ui.checkBox_time,
|
'uptime':self.ui.checkBox_uptime, 'player':self.ui.checkBox_player,
|
||||||
'custom':self.ui.checkBox_custom}
|
'time':self.ui.checkBox_time}
|
||||||
self.lineedits = {'bat':self.ui.lineEdit_bat, 'cpu':self.ui.lineEdit_cpu,
|
self.lineedits = {'bat':self.ui.lineEdit_bat, 'cpu':self.ui.lineEdit_cpu,
|
||||||
'cpuclock':self.ui.lineEdit_cpuclock, 'gpu':self.ui.lineEdit_gpu,
|
'cpuclock':self.ui.lineEdit_cpuclock, 'custom':self.ui.lineEdit_custom,
|
||||||
'gputemp':self.ui.lineEdit_gpuTemp, 'hdd':self.ui.lineEdit_hdd,
|
'gpu':self.ui.lineEdit_gpu, 'gputemp':self.ui.lineEdit_gpuTemp,
|
||||||
'hddtemp':self.ui.lineEdit_hddTemp, 'mem':self.ui.lineEdit_mem,
|
'hdd':self.ui.lineEdit_hdd, 'hddtemp':self.ui.lineEdit_hddTemp,
|
||||||
'net':self.ui.lineEdit_net, 'swap':self.ui.lineEdit_swap,
|
'mem':self.ui.lineEdit_mem, 'net':self.ui.lineEdit_net,
|
||||||
'temp':self.ui.lineEdit_temp, 'uptime':self.ui.lineEdit_uptime,
|
'swap':self.ui.lineEdit_swap, 'temp':self.ui.lineEdit_temp,
|
||||||
'player':self.ui.lineEdit_player, 'time':self.ui.lineEdit_time,
|
'uptime':self.ui.lineEdit_uptime, 'player':self.ui.lineEdit_player,
|
||||||
'custom':self.ui.lineEdit_custom}
|
'time':self.ui.lineEdit_time}
|
||||||
self.sliders = {'bat':self.ui.slider_bat, 'cpu':self.ui.slider_cpu,
|
self.sliders = {'bat':self.ui.slider_bat, 'cpu':self.ui.slider_cpu,
|
||||||
'cpuclock':self.ui.slider_cpuclock, 'gpu':self.ui.slider_gpu,
|
'cpuclock':self.ui.slider_cpuclock, 'custom':self.ui.slider_custom,
|
||||||
'gputemp':self.ui.slider_gpuTemp, 'hdd':self.ui.slider_hdd,
|
'gpu':self.ui.slider_gpu, 'gputemp':self.ui.slider_gpuTemp,
|
||||||
'hddtemp':self.ui.slider_hddTemp, 'mem':self.ui.slider_mem,
|
'hdd':self.ui.slider_hdd, 'hddtemp':self.ui.slider_hddTemp,
|
||||||
'net':self.ui.slider_net, 'swap':self.ui.slider_swap,
|
'mem':self.ui.slider_mem, 'net':self.ui.slider_net,
|
||||||
'temp':self.ui.slider_temp, 'uptime':self.ui.slider_uptime,
|
'swap':self.ui.slider_swap, 'temp':self.ui.slider_temp,
|
||||||
'player':self.ui.slider_player, 'time':self.ui.slider_time,
|
'uptime':self.ui.slider_uptime, 'player':self.ui.slider_player,
|
||||||
'custom':self.ui.slider_custom}
|
'time':self.ui.slider_time}
|
||||||
|
|
||||||
QObject.connect(self.ui.checkBox_netdev, SIGNAL("stateChanged(int)"), self.setNetdevEnabled)
|
QObject.connect(self.ui.checkBox_netdev, SIGNAL("stateChanged(int)"), self.setNetdevEnabled)
|
||||||
QObject.connect(self.ui.pushButton_hddDevice, SIGNAL("clicked()"), self.addHddDevice)
|
QObject.connect(self.ui.pushButton_hddDevice, SIGNAL("clicked()"), self.addHddDevice)
|
||||||
|
@ -88,7 +88,7 @@ class pyTextWidget(plasmascript.Applet):
|
|||||||
def createConfigurationInterface(self, parent):
|
def createConfigurationInterface(self, parent):
|
||||||
"""function to setup configuration window"""
|
"""function to setup configuration window"""
|
||||||
self.configpage = configwindow.ConfigWindow(self)
|
self.configpage = configwindow.ConfigWindow(self)
|
||||||
self.configdef = configdef.ConfigDefinition(self, self.configpage)
|
self.configdef = configdef.ConfigDefinition(self, self.configpage, self.ptm['defaults'])
|
||||||
self.configdef.createConfigurationInterface(parent)
|
self.configdef.createConfigurationInterface(parent)
|
||||||
|
|
||||||
|
|
||||||
@ -139,9 +139,21 @@ class pyTextWidget(plasmascript.Applet):
|
|||||||
self.ptm['dataengine'] = {'ext':None, 'system':None, 'time':None}
|
self.ptm['dataengine'] = {'ext':None, 'system':None, 'time':None}
|
||||||
# defaults
|
# defaults
|
||||||
self.ptm['defaults'] = {}
|
self.ptm['defaults'] = {}
|
||||||
self.ptm['defaults']['order'] = {'6':'bat', '1':'cpu', '7':'cpuclock', 'f':'custom', '9':'gpu',
|
self.ptm['defaults']['confBool'] = {'bat':'batBool', 'cpu':'cpuBool',
|
||||||
'a':'gputemp', 'b':'hdd', 'c':'hddtemp', '3':'mem', '5':'net', '4':'swap', '2':'temp',
|
'cpuclock':'cpuclockBool', 'custom':'customBool', 'gpu':'gpuBool',
|
||||||
'8':'uptime', 'd':'player', 'e':'time'}
|
'gputemp':'gputempBool', 'hdd':'hddBool', 'hddtemp':'hddtempBool',
|
||||||
|
'mem':'memBool', 'net':'netBool', 'swap':'swapBool', 'temp':'tempBool',
|
||||||
|
'uptime':'uptimeBool', 'player':'playerBool', 'time':'timeBool'}
|
||||||
|
self.ptm['defaults']['confColor'] = {'cpu':'cpu_color', 'cpuclock':'cpuclock_color',
|
||||||
|
'down':'down_color', 'mem':'mem_color', 'swap':'swap_color', 'up':'up_color'}
|
||||||
|
self.ptm['defaults']['confFormat'] = {'bat':'batFormat', 'cpu':'cpuFormat',
|
||||||
|
'cpuclock':'cpuclockFormat', 'custom':'customFormat', 'gpu':'gpuFormat',
|
||||||
|
'gputemp':'gputempFormat', 'hdd':'hddFormat', 'hddtemp':'hddtempFormat',
|
||||||
|
'mem':'memFormat', 'net':'netFormat', 'swap':'swapFormat', 'temp':'tempFormat',
|
||||||
|
'uptime':'uptimeFormat', 'player':'playerFormat', 'time':'timeFormat'}
|
||||||
|
self.ptm['defaults']['bool'] = {'bat':0, 'cpu':2, 'cpuclock':0, 'custom':0,
|
||||||
|
'gpu':0, 'gputemp':0, 'hdd':0, 'hddtemp':0, 'mem':2, 'net':2, 'swap':2,
|
||||||
|
'temp':0, 'uptime':0, 'player':0, 'time':0}
|
||||||
self.ptm['defaults']['format'] = {'bat':'[bat: $bat%$ac]', 'cpu':'[cpu: $cpu%]',
|
self.ptm['defaults']['format'] = {'bat':'[bat: $bat%$ac]', 'cpu':'[cpu: $cpu%]',
|
||||||
'cpuclock':'[mhz: $cpucl]', 'custom':'[$custom]', 'gpu':'[gpu: $gpu%]',
|
'cpuclock':'[mhz: $cpucl]', 'custom':'[$custom]', 'gpu':'[gpu: $gpu%]',
|
||||||
'gputemp':'[gpu temp: $gputemp°C]', 'hdd':'[hdd: $hdd0%]',
|
'gputemp':'[gpu temp: $gputemp°C]', 'hdd':'[hdd: $hdd0%]',
|
||||||
@ -149,6 +161,9 @@ class pyTextWidget(plasmascript.Applet):
|
|||||||
'net':'[$netdev: $down/$upKB/s]', 'swap':'[swap: $swap%]',
|
'net':'[$netdev: $down/$upKB/s]', 'swap':'[swap: $swap%]',
|
||||||
'temp':'[temp: $temp0°C]', 'uptime':'[uptime: $uptime]',
|
'temp':'[temp: $temp0°C]', 'uptime':'[uptime: $uptime]',
|
||||||
'player':'[$artist - $title]', 'time':'[$time]'}
|
'player':'[$artist - $title]', 'time':'[$time]'}
|
||||||
|
self.ptm['defaults']['order'] = {'6':'bat', '1':'cpu', '7':'cpuclock', 'f':'custom', '9':'gpu',
|
||||||
|
'a':'gputemp', 'b':'hdd', 'c':'hddtemp', '3':'mem', '5':'net', '4':'swap', '2':'temp',
|
||||||
|
'8':'uptime', 'd':'player', 'e':'time'}
|
||||||
# labels
|
# labels
|
||||||
self.ptm['labels'] = {}
|
self.ptm['labels'] = {}
|
||||||
self.ptm['layout'] = QGraphicsLinearLayout(Qt.Horizontal, self.applet)
|
self.ptm['layout'] = QGraphicsLinearLayout(Qt.Horizontal, self.applet)
|
||||||
@ -432,7 +447,6 @@ class pyTextWidget(plasmascript.Applet):
|
|||||||
def setNetdev(self):
|
def setNetdev(self):
|
||||||
"""function to set network device"""
|
"""function to set network device"""
|
||||||
netdev = "lo"
|
netdev = "lo"
|
||||||
self.ptm['vars']['adv']
|
|
||||||
netdir = self.ptm['vars']['adv']['netDir']
|
netdir = self.ptm['vars']['adv']['netDir']
|
||||||
interfaces = QDir.entryList(QDir(netdir), QDir.Dirs | QDir.NoDotAndDotDot)
|
interfaces = QDir.entryList(QDir(netdir), QDir.Dirs | QDir.NoDotAndDotDot)
|
||||||
for device in interfaces:
|
for device in interfaces:
|
||||||
@ -452,21 +466,81 @@ class pyTextWidget(plasmascript.Applet):
|
|||||||
self.ptm['labels'][name].setText(text)
|
self.ptm['labels'][name].setText(text)
|
||||||
|
|
||||||
|
|
||||||
|
def textPrepare(self, name=None, text=None):
|
||||||
|
"""function to prepare text"""
|
||||||
|
line = self.ptm['vars']['formats'][name]
|
||||||
|
if (name == "custom"):
|
||||||
|
if (line.split('$custom')[0] != line):
|
||||||
|
line = line.split('$custom')[0] + text + line.split('$custom')[1]
|
||||||
|
elif (name == "gpu"):
|
||||||
|
if (line.split('$gpu')[0] != line):
|
||||||
|
line = line.split('$gpu')[0] + text + line.split('$gpu')[1]
|
||||||
|
elif (name == "gputemp"):
|
||||||
|
if (line.split('$gputemp')[0] != line):
|
||||||
|
line = line.split('$gputemp')[0] + text + line.split('$gputemp')[1]
|
||||||
|
elif (name == "player"):
|
||||||
|
if (line.split('$album')[0] != line):
|
||||||
|
line = line.split('$album')[0] + self.ptm['values']['player']['album'] + line.split('$album')[1]
|
||||||
|
if (line.split('$artist')[0] != line):
|
||||||
|
line = line.split('$artist')[0] + self.ptm['values']['player']['artist'] + line.split('$artist')[1]
|
||||||
|
if (line.split('$progress')[0] != line):
|
||||||
|
line = line.split('$progress')[0] + self.ptm['values']['player']['progress'] + line.split('$progress')[1]
|
||||||
|
if (line.split('$time')[0] != line):
|
||||||
|
line = line.split('$time')[0] + self.ptm['values']['player']['time'] + line.split('$time')[1]
|
||||||
|
if (line.split('$title')[0] != line):
|
||||||
|
line = line.split('$title')[0] + self.ptm['values']['player']['title'] + line.split('$title')[1]
|
||||||
|
elif (name == "time"):
|
||||||
|
if (line.split('$time')[0] != line):
|
||||||
|
line = line.split('$time')[0] + text + line.split('$time')[1]
|
||||||
|
elif (line.split('$isotime')[0] != line):
|
||||||
|
line = line.split('$isotime')[0] + text + line.split('$isotime')[1]
|
||||||
|
elif (line.split('$shorttime')[0] != line):
|
||||||
|
line = line.split('$shorttime')[0] + text + line.split('$shorttime')[1]
|
||||||
|
elif (line.split('$longtime')[0] != line):
|
||||||
|
line = line.split('$longtime')[0] + text + line.split('$longtime')[1]
|
||||||
|
elif (line.split('$custom')[0] != line):
|
||||||
|
line = line.split('$custom')[0] + text + line.split('$custom')[1]
|
||||||
|
elif (name == "uptime"):
|
||||||
|
if (line.split('$uptime')[0] != line):
|
||||||
|
line = line.split('$uptime')[0] + text + line.split('$uptime')[1]
|
||||||
|
elif (line.split('$custom')[0] != line):
|
||||||
|
line = line.split('$custom')[0] + text + line.split('$custom')[1]
|
||||||
|
output = self.ptm['vars']['app']['format'].split('$LINE')[0] + line + self.ptm['vars']['app']['format'].split('$LINE')[1]
|
||||||
|
return output
|
||||||
|
|
||||||
|
|
||||||
@pyqtSignature("dataUpdated(const QString &, const Plasma::DataEngine::Data &)")
|
@pyqtSignature("dataUpdated(const QString &, const Plasma::DataEngine::Data &)")
|
||||||
def dataUpdated(self, sourceName, data):
|
def dataUpdated(self, sourceName, data):
|
||||||
"""function to update label"""
|
"""function to update label"""
|
||||||
updatedData = self.dataengine.dataUpdated(str(sourceName), data, self.ptm)
|
updatedData = self.dataengine.dataUpdated(str(sourceName), data, self.ptm)
|
||||||
# update tooltips
|
# update falues where is needed
|
||||||
if (updatedData['name'] in ['cpu', 'cpuclock', 'mem', 'swap', 'net']):
|
|
||||||
pass
|
|
||||||
# update labels where is needed
|
|
||||||
if (updatedData['name'] in ['gpu', 'gputemp', 'player']):
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
if (updatedData['type']):
|
if (updatedData['type']):
|
||||||
pass
|
self.ptm['values'][updatedData['name']][updatedData['type']] = updatedData['values']
|
||||||
else:
|
else:
|
||||||
pass
|
self.ptm['values'][updatedData['name']] = updatedData['values']
|
||||||
|
# update labels where is needed
|
||||||
|
if (updatedData['name'] in ['custom', 'gpu', 'gputemp', 'player', 'time', 'uptime']):
|
||||||
|
text = self.textPrepare(updatedData['name'], updatedData['value'])
|
||||||
|
self.setText(updatedData['name'], text)
|
||||||
|
# update tooltips
|
||||||
|
if ((updatedData['name'] in ['cpu', 'cpuclock', 'mem', 'swap', 'net']) and (self.ptm['vars']['bools'][updatedData['name']] == 2)):
|
||||||
|
if (updatedData['name'] == "net"):
|
||||||
|
if (len(self.ptm['tooltip']['values'][updatedData['type']]) > self.ptm['vars']['tooltip']['num']):
|
||||||
|
self.ptm['tooltip']['values'][updatedData['type']] = self.ptm['tooltip']['values'][updatedData['type']][1:]
|
||||||
|
else:
|
||||||
|
if (len(self.ptm['tooltip']['values'][updatedData['name']]) > self.ptm['vars']['tooltip']['num']):
|
||||||
|
self.ptm['tooltip']['values'][updatedData['name']] = self.ptm['tooltip']['values'][updatedData['name']][1:]
|
||||||
|
if ((updatedData['name'] in ['cpu', 'cpuclock']) and (updatedData['type'] == -1)):
|
||||||
|
self.ptm['tooltip']['values'][updatedData['name']].append(updatedData['value'])
|
||||||
|
elif ((updatedData['name'] == "mem") and (updatedData['type'] == "app")):
|
||||||
|
self.ptm['tooltip']['values'][updatedData['name']].append(updatedData['value'])
|
||||||
|
elif ((updatedData['name'] == "mem") and (updatedData['type'] == "used")):
|
||||||
|
self.ptm['tooltip']['bounds']['mem'] = self.ptm['values']['mem']['free'] + self.ptm['values']['mem']['used']
|
||||||
|
elif ((updatedData['name'] == "swap") and (updatedData['type'] == "used")):
|
||||||
|
self.ptm['tooltip']['values'][updatedData['name']].append(updatedData['value'])
|
||||||
|
self.ptm['tooltip']['bounds']['swap'] = self.ptm['values']['swap']['free'] + self.ptm['values']['swap']['used']
|
||||||
|
elif (updatedData['name'] == "net"):
|
||||||
|
self.ptm['tooltip']['values'][updatedData['type']].append(updatedData['value'])
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,10 +65,7 @@ class Reinit():
|
|||||||
|
|
||||||
ptmVars['bools'] = {}
|
ptmVars['bools'] = {}
|
||||||
for label in self.labels:
|
for label in self.labels:
|
||||||
if (label in ['cpu', 'mem', 'swap', 'net']):
|
ptmVars['bools'][label] = settings.get(self.defaults['confBool'][label], self.defaults['bool'][label]).toInt()[0]
|
||||||
exec("ptmVars['bools'][label] = settings.get('" + label + "Bool', 2).toInt()[0]")
|
|
||||||
else:
|
|
||||||
exec("ptmVars['bools'][label] = settings.get('" + label + "Bool', 0).toInt()[0]")
|
|
||||||
|
|
||||||
ptmNames = {}
|
ptmNames = {}
|
||||||
ptmNames['hdd'] = str(settings.get('mount', '/')).split('@@')
|
ptmNames['hdd'] = str(settings.get('mount', '/')).split('@@')
|
||||||
@ -85,7 +82,7 @@ class Reinit():
|
|||||||
for order in ptmVars['app']['order']:
|
for order in ptmVars['app']['order']:
|
||||||
label = self.defaults['order'][order]
|
label = self.defaults['order'][order]
|
||||||
if (ptmVars['bools'][label] > 0):
|
if (ptmVars['bools'][label] > 0):
|
||||||
exec("ptmVars['formats'][label] = str(settings.get('" + label + "Format', self.defaults['format'][label]))")
|
ptmVars['formats'][label] = str(settings.get(self.defaults['confFormat'][label], self.defaults['format'][label]))
|
||||||
text = ptmVars['app']['format'].split('$LINE')[0] + ptmVars['formats'][label] + ptmVars['app']['format'].split('$LINE')[1]
|
text = ptmVars['app']['format'].split('$LINE')[0] + ptmVars['formats'][label] + ptmVars['app']['format'].split('$LINE')[1]
|
||||||
self.parent.addLabel(label, text, True)
|
self.parent.addLabel(label, text, True)
|
||||||
if ((label in ['cpu', 'cpuclock', 'mem', 'net', 'swap']) and (ptmVars['bools'][label] == 2)):
|
if ((label in ['cpu', 'cpuclock', 'mem', 'net', 'swap']) and (ptmVars['bools'][label] == 2)):
|
||||||
|
@ -28,13 +28,6 @@ class Tooltip():
|
|||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
|
||||||
|
|
||||||
def addValue(self, type, value=0.0, tooltipNum=100):
|
|
||||||
"""function to add value to list"""
|
|
||||||
if (len(self.parent.tooltipValues[type]) > tooltipNum):
|
|
||||||
self.parent.tooltipValues[type] = self.parent.tooltipValues[type][1:]
|
|
||||||
self.parent.tooltipValues[type].append(value)
|
|
||||||
|
|
||||||
|
|
||||||
def createGraphic(self, types, colors, bounds, values, widget):
|
def createGraphic(self, types, colors, bounds, values, widget):
|
||||||
"""function to create graph"""
|
"""function to create graph"""
|
||||||
widget.clear()
|
widget.clear()
|
||||||
|
@ -44,7 +44,6 @@ class Util():
|
|||||||
def createNotifyrc(self):
|
def createNotifyrc(self):
|
||||||
print ('[%s] creating notifyrc' % (self.applet._name))
|
print ('[%s] creating notifyrc' % (self.applet._name))
|
||||||
self.createDirectory(self.kdeHome() + 'share/apps/%s' % self.applet._name)
|
self.createDirectory(self.kdeHome() + 'share/apps/%s' % self.applet._name)
|
||||||
|
|
||||||
source = self.applet.package().path() + 'contents/misc/%s.notifyrc' % self.applet._name
|
source = self.applet.package().path() + 'contents/misc/%s.notifyrc' % self.applet._name
|
||||||
destination = self.kdeHome() + 'share/apps/%s/%s.notifyrc' % (self.applet._name, self.applet._name)
|
destination = self.kdeHome() + 'share/apps/%s/%s.notifyrc' % (self.applet._name, self.applet._name)
|
||||||
copyfile(source, destination)
|
copyfile(source, destination)
|
||||||
@ -52,7 +51,6 @@ class Util():
|
|||||||
|
|
||||||
def createConfig(self):
|
def createConfig(self):
|
||||||
self.createDirectory(self.kdeHome() + 'share/apps/%s' % self.applet._name)
|
self.createDirectory(self.kdeHome() + 'share/apps/%s' % self.applet._name)
|
||||||
|
|
||||||
source = self.applet.package().path() + 'contents/misc/%s.ini' % self.applet._name
|
source = self.applet.package().path() + 'contents/misc/%s.ini' % self.applet._name
|
||||||
destination = self.kdeHome() + 'share/apps/%s/%s.ini' % (self.applet._name, self.applet._name)
|
destination = self.kdeHome() + 'share/apps/%s/%s.ini' % (self.applet._name, self.applet._name)
|
||||||
copyfile(source, destination)
|
copyfile(source, destination)
|
||||||
|
Loading…
Reference in New Issue
Block a user