usbinstall.py3: update to python3

This commit is contained in:
Silvan Calarco 2020-12-21 19:54:39 +01:00
parent b8f8f1b28f
commit 7d3b490acf

View File

@ -1,7 +1,8 @@
#!/usr/bin/python
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright 2011 michiamophil (openmamba user :-)
# Copyright 2011-2020 Silvan Calarco
# ChangeLog:
# (michiamophil on 11/11/11) Rewrited all the graphic code and removed gui.py
@ -10,12 +11,12 @@ from PyQt4 import QtGui, QtCore
from subprocess import Popen
import signal
import gettext # To translate
import gobject
from gi.repository import GLib
import dbus
import dbus.service
from dbus.mainloop.glib import DBusGMainLoop
if getattr(dbus, 'version', (0,0,0)) >= (0,41,0):
import dbus.glib
DBusGMainLoop(set_as_default=True)
#import dbus.glib
#=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
#1)-------------------------------(VARIABILI)----------------------------------------
@ -189,7 +190,7 @@ def go_back():
# Step 1 to 0 -> exit
if step == 0:
app.exit(1)
print _("Application terminated by pressing \"cancel\" button")
print (_("Application terminated by pressing \"cancel\" button"))
# Step 2 to 1
elif step == 1:
step1()
@ -202,7 +203,7 @@ def choose_file():
global path_cpio, path_iso, choose_type
# if step is 1
if choose_type == "iso":
nfileName = QtGui.QFileDialog.getOpenFileName(window, _("Choose the iso file"), "/home", "File .iso (*.iso)", "iso *.iso")
nfileName = QtGui.QFileDialog.getOpenFileName(window, _("Choose the iso file"), "/home", "File .iso (*.iso)")
path_iso = nfileName
window.t_file.setText(nfileName)
@ -234,7 +235,7 @@ def get_list():
bus = dbus.SystemBus()
ud_manager_obj = bus.get_object('org.freedesktop.UDisks2', '/org/freedesktop/UDisks2')
ud_manager = dbus.Interface(ud_manager_obj, 'org.freedesktop.DBus.ObjectManager')
for k,v in ud_manager.GetManagedObjects().iteritems():
for k,v in ud_manager.GetManagedObjects().items():
device_block = v.get('org.freedesktop.UDisks2.Block', {})
device_partitiontable = v.get('org.freedesktop.UDisks2.PartitionTable', {})
device = device_block.get('Device')
@ -264,7 +265,7 @@ def get_list():
if len(a_path_dev) != 0:
set_usb(0)
else:
print _("No usb available > 1 Gb")
print (_("No usb available > 1 Gb"))
# Event n°7
def set_usb(i):
@ -392,7 +393,7 @@ def end_with_success():
msg = QtGui.QMessageBox.information(window, _("Information"), _("Installation process completed"))
mainloop.quit()
app.exit(0)
print _("Installation process completed")
print (_("Installation process completed"))
def end_forced():
global process_sh, mainloop
@ -402,9 +403,9 @@ def end_forced():
# Program start
app = QtGui.QApplication(['usbinstall'])
gettext.install('usbinstall', '/usr/share/locale', unicode=1)
gettext.install('usbinstall', '/usr/share/locale', 1)
window = create_window()
mainloop = gobject.MainLoop()
mainloop = GLib.MainLoop()
def run():
add_events()