master
parent
ce100c451d
commit
b92f36bbb2
|
@ -12,8 +12,6 @@ import json
|
|||
INTERVAL = 15
|
||||
|
||||
class HelloPython(plasmascript.Applet):
|
||||
def __init__(self,parent,args=None):
|
||||
super(HelloPython, self).__init__(parent)
|
||||
|
||||
def init(self):
|
||||
self.setHasConfigurationInterface(False)
|
||||
|
@ -35,6 +33,7 @@ class HelloPython(plasmascript.Applet):
|
|||
self.applet.setLayout(self.layout)
|
||||
self.update_list()
|
||||
|
||||
self.connect_to_engine()
|
||||
self.resize(125, 125)
|
||||
|
||||
def get_user_list(self):
|
||||
|
@ -45,20 +44,16 @@ class HelloPython(plasmascript.Applet):
|
|||
users = json.loads(api_content)["users"]
|
||||
return (x["login"] for x in users)
|
||||
|
||||
|
||||
def connectToEngine(self):
|
||||
def connect_to_engine(self):
|
||||
self.timeEngine = self.dataEngine("time")
|
||||
self.timeEngine.connectSource(self.currentTimezone,
|
||||
self.timeEngine.connectSource("Local",
|
||||
self, INTERVAL*6000, Plasma.AlignToMinute)
|
||||
|
||||
|
||||
def update_list(self):
|
||||
self.at_list.setText("\n".join(self.get_user_list()))
|
||||
|
||||
|
||||
@pyqtSignature("dataUpdated(const QString &, const Plasma::DataEngine::Data &)")
|
||||
def dataUpdated(self, sourceName, data):
|
||||
|
||||
self.update_list()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue