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