diff options
Diffstat (limited to 'usr')
-rw-r--r-- | usr/share/mageiawelcome/helpers.py | 2 | ||||
-rw-r--r-- | usr/share/mageiawelcome/mageiawelcome.py | 22 | ||||
-rw-r--r-- | usr/share/mageiawelcome/webgui.py | 24 |
3 files changed, 25 insertions, 23 deletions
diff --git a/usr/share/mageiawelcome/helpers.py b/usr/share/mageiawelcome/helpers.py index 5899b54..7fc43e3 100644 --- a/usr/share/mageiawelcome/helpers.py +++ b/usr/share/mageiawelcome/helpers.py @@ -51,7 +51,7 @@ def get_listapp(): listapp = '' with open("apps.csv", 'rb') as f: mycsv = csv.reader(f,delimiter='|') - mycsv.next() + next(mycsv) for r in mycsv: if (r[5] == 'false'): start_btn = "" diff --git a/usr/share/mageiawelcome/mageiawelcome.py b/usr/share/mageiawelcome/mageiawelcome.py index 2c2ab9d..072738a 100644 --- a/usr/share/mageiawelcome/mageiawelcome.py +++ b/usr/share/mageiawelcome/mageiawelcome.py @@ -3,8 +3,8 @@ import signal import os import time -import urllib -import commands +import urllib.request, urllib.parse, urllib.error +import subprocess import subprocess import shlex import gettext @@ -43,9 +43,9 @@ def main(): #collect sys info #release = open("/etc/release", "r").read() - release = commands.getoutput('lsb_release -sd') + release = subprocess.getoutput('lsb_release -sd') release = release[1:-1] - kernel = commands.getoutput('uname -r') + kernel = subprocess.getoutput('uname -r') if os.uname()[4] == 'x86_64': arch = '64-bit' else: @@ -200,32 +200,32 @@ def main(): elif msg.startswith("run"): args = shlex.split(msg) args.pop(0) - print args + print(args) if args[0] == "xvt": os.chdir(home) subprocess.Popen(args) elif msg.startswith("gurpmi"): - print msg + print(msg) args = shlex.split(msg) cat = args.pop(1) - print args + print(args) proc = subprocess.Popen(args, stdout=subprocess.PIPE) proc.wait() - print proc.returncode + print(proc.returncode) if (proc.returncode == 0): listapp = get_listapp() web_send('$("ul#lista_applikacji").html("'+listapp+'");$("li#'+cat+'").trigger("click");') else: pass elif msg.startswith("install_selected"): - print msg + print(msg) msg2 = msg.replace('install_selected','gurpmi') args = shlex.split(msg2) cat = args.pop(1) - print args + print(args) proc = subprocess.Popen(args, stdout=subprocess.PIPE) proc.wait() - print proc.returncode + print(proc.returncode) if (proc.returncode == 0): listapp = get_listapp() web_send('$("ul#lista_applikacji").html("'+listapp+'");$("li#'+cat+'").trigger("click");') diff --git a/usr/share/mageiawelcome/webgui.py b/usr/share/mageiawelcome/webgui.py index c6888fa..57b4624 100644 --- a/usr/share/mageiawelcome/webgui.py +++ b/usr/share/mageiawelcome/webgui.py @@ -1,7 +1,7 @@ import time -import Queue -import thread -import urllib +import queue +import _thread +import urllib.request, urllib.parse, urllib.error import gi from gi.repository import Gdk @@ -47,8 +47,9 @@ if use is UseWebKit: def asynchronous_gtk_message(fun): - def worker((function, args, kwargs)): - apply(function, args, kwargs) + def worker(xxx_todo_changeme): + (function, args, kwargs) = xxx_todo_changeme + function(*args, **kwargs) def fun2(*args, **kwargs): GLib.idle_add(worker, (fun, args, kwargs)) @@ -60,8 +61,9 @@ def synchronous_gtk_message(fun): class NoResult: pass - def worker((R, function, args, kwargs)): - R.result = apply(function, args, kwargs) + def worker(xxx_todo_changeme1): + (R, function, args, kwargs) = xxx_todo_changeme1 + R.result = function(*args, **kwargs) def fun2(*args, **kwargs): class R: result = NoResult @@ -94,7 +96,7 @@ def launch_browser(html, quit_function=None, echo=True): window.set_resizable(False) window.show_all() - message_queue = Queue.Queue() + message_queue = queue.Queue() def title_changed(title): if title != 'null': message_queue.put(title) @@ -108,11 +110,11 @@ def launch_browser(html, quit_function=None, echo=True): return None else: msg = message_queue.get() - if echo: print '>>>', msg + if echo: print('>>>', msg) return msg def web_send(msg): - if echo: print '<<<', msg + if echo: print('<<<', msg) asynchronous_gtk_message(implementation.inject_javascript)(browser, msg) return browser, web_recv, web_send @@ -122,7 +124,7 @@ def start_gtk_thread(): # Start GTK in its own thread: Gdk.threads_init() Gdk.threads_enter() - thread.start_new_thread(Gtk.main, ()) + _thread.start_new_thread(Gtk.main, ()) def kill_gtk_thread(): asynchronous_gtk_message(Gtk.main_quit)() |