zexrcvtyuboimpk
parent
5a6fdad6a0
commit
9344b13319
|
@ -41,10 +41,7 @@ class HelloPython(plasmascript.Applet):
|
|||
self.resize(125, 125)
|
||||
|
||||
def get_user_list(self):
|
||||
try:
|
||||
api_content = urlopen("https://at.hackerspace.pl/api").read()
|
||||
except (URLError, HTTPError):
|
||||
pass # TODO:
|
||||
api_content = urlopen("https://at.hackerspace.pl/api").read()
|
||||
json_dict = json.loads(api_content)
|
||||
users = json_dict["users"]
|
||||
unknown = json_dict["unknown"]
|
||||
|
@ -53,12 +50,15 @@ class HelloPython(plasmascript.Applet):
|
|||
def connect_to_engine(self):
|
||||
self.timeEngine = self.dataEngine("time")
|
||||
self.timeEngine.connectSource("Local",
|
||||
self, INTERVAL*6000, Plasma.AlignToMinute)
|
||||
self, INTERVAL*6000, Plasma.AlignToMinute)
|
||||
|
||||
def update_list(self):
|
||||
users, unknown = self.get_user_list()
|
||||
users = "\n".join(users)
|
||||
self.at_list.setText(LABEL_TEMPLATE.format(users=users, unknown=unknown))
|
||||
try:
|
||||
users, unknown = self.get_user_list()
|
||||
users = "\n".join(users)
|
||||
self.at_list.setText(LABEL_TEMPLATE.format(users=users, unknown=unknown))
|
||||
except (URLError, HTTPError):
|
||||
self.at_list.setText("hakerspejs umar")
|
||||
|
||||
@pyqtSignature("dataUpdated(const QString &, const Plasma::DataEngine::Data &)")
|
||||
def dataUpdated(self, sourceName, data):
|
||||
|
|
Loading…
Reference in New Issue