run python 2to3

This commit is contained in:
Nedko Arnaudov 2023-01-29 15:31:05 +02:00
parent 19f5455eb2
commit e7212ab6af
12 changed files with 39 additions and 39 deletions

View File

@ -194,8 +194,8 @@ class jackctl_g15:
status_line += " started in non-realtime mode"
else:
status_line += " stopped"
except Exception, e:
print repr(e)
except Exception as e:
print(repr(e))
status_line = "JACK cannot be connected"
if self.jack:
self.g15.clear(False)

View File

@ -41,16 +41,16 @@ def check_ladish():
try:
proxy = laditools.ladish_proxy()
except:
print "ladish proxy creation failed"
print("ladish proxy creation failed")
return
if not proxy.is_available():
print "ladish is not available"
print("ladish is not available")
return
if proxy.studio_is_loaded():
if not proxy.studio_is_started():
print "ladish studio is loaded and not started"
print("ladish studio is loaded and not started")
return
else:
msg = "JACK can only be configured with a stopped studio. Please stop your studio first."
@ -240,7 +240,7 @@ class cell_renderer_param(gtk.GenericCellRenderer):
else:
self.set_property('mode', gtk.CELL_RENDERER_MODE_EDITABLE)
else:
print pspec.name
print(pspec.name)
setattr(self, pspec.name, value)
def do_get_property(self, pspec):
@ -335,7 +335,7 @@ class cell_renderer_param(gtk.GenericCellRenderer):
if typechar == 'u' or typechar == 'i':
try:
value = int(value_str)
except ValueError, e:
except ValueError as e:
# Hide the widget (because it may display something else than what user typed in)
widget.hide()
# Display the error

View File

@ -43,7 +43,7 @@ try:
pygtk.require ('2.0')
import gtk
import vte
except Exception, e:
except Exception as e:
error = gtk.MessageDialog (None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, _("You need to get you dependencies right before you run this program. Ask your package maintainer why this is happening to you\n%s") % repr(e))
error.run ()
exit (1)
@ -113,9 +113,9 @@ class ladilog(object):
# skip logfiles that dont exist
if not os.access(log['logfile_path'], os.R_OK):
self.log_files.remove(log)
print _("Skipping '%s' because it does not exist") % log['logfile_path']
print(_("Skipping '%s' because it does not exist") % log['logfile_path'])
else:
print _("Watching '%s'") % log['logfile_path']
print(_("Watching '%s'") % log['logfile_path'])
max_lines_text = self.param_dict['max_lines']
self.max_lines = int (max_lines_text)
@ -149,9 +149,9 @@ class ladilog(object):
log["term"].feed(line)
except ValueError:
print _("You called Popen with invalid arguments... dumbass")
print(_("You called Popen with invalid arguments... dumbass"))
except:
print _("Unexpected error:"), sys.exc_info ()[0]
print(_("Unexpected error:"), sys.exc_info ()[0])
for log in self.log_files:
self.logview_notebook.append_page (log["term"])
@ -191,7 +191,7 @@ class ladilog(object):
try:
ladilog().run()
except Exception, e:
except Exception as e:
error = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, _("Unexpected error\n\n") + repr(e))
error.run()
exit(1)

View File

@ -107,7 +107,7 @@ class laditray (gtk.StatusIcon, laditools.manager):
self.set_tooltip_safe ("JACK is stopped")
self.set_icon ("stopped")
self.clear_diagnose_text()
except Exception, e:
except Exception as e:
self.set_tooltip_safe ("JACK is sick")
self.set_diagnose_text(repr(e))
self.set_icon ("stopped")

View File

@ -144,10 +144,10 @@ class wmladi (wmoo.Application, laditools.manager):
self.clear_line(5)
self.started = False
self.clear_diagnose_text()
except Exception, e:
except Exception as e:
self.set_diagnose_text(repr(e))
if debug:
print repr (e)
print(repr (e))
self.set_line(0, "JACK")
self.set_line(1, "is sick")
self.clear_line(2)

View File

@ -292,7 +292,7 @@ class TreeViewTooltips:
def get_tooltip(self, view, column, path):
'See the module doc string for a description of this method'
raise NotImplemented, 'Subclass must implement get_tooltip()'
raise NotImplemented('Subclass must implement get_tooltip()')
if __name__ == '__main__':

View File

@ -15,12 +15,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from jack_controller import jack_controller
from jack_configure import jack_configure
from ladimenu import manager, find_data_file
from a2j_controller import a2j_controller
from a2j_menu import a2j_menu
from ladish_controller import ladish_proxy
from .jack_controller import jack_controller
from .jack_configure import jack_configure
from .ladimenu import manager, find_data_file
from .a2j_controller import a2j_controller
from .a2j_menu import a2j_menu
from .ladish_controller import ladish_proxy
# from error import error
from config import config
from TreeViewTooltips import TreeViewTooltips
from .config import config
from .TreeViewTooltips import TreeViewTooltips

View File

@ -31,7 +31,7 @@ class a2j_controller:
try:
self.iface.is_started()
return True
except Exception, e:
except Exception as e:
#print repr(e)
return False

View File

@ -25,7 +25,7 @@ from xdg import BaseDirectory as basedir
config_dir = path.join(basedir.xdg_config_home, 'laditools')
config_filename = path.join(config_dir, 'laditools.conf')
if not exists (config_dir):
mkdir (config_dir, 0755)
mkdir (config_dir, 0o755)
# Note to users of the config class. Only applications should create an instance
# of the config object. The ladimenu is *NOT* an application...

View File

@ -42,7 +42,7 @@ class jack_configure:
# self.bus.add_signal_receiver (self.name_owner_changed, dbus_interface = controller_interface_name, signal_name = "NameOwnerChanged")
def name_owner_changed (name = None, old_owner = None, new_owner = None):
print "Name changed : %r" % name
print("Name changed : %r" % name)
def get_selected_driver (self):
isset, default, value = self.iface.GetParameterValue (['engine', 'driver'])

View File

@ -23,11 +23,11 @@ pygtk.require('2.0')
import gtk
import gobject
import subprocess
from config import config
from jack_configure import jack_configure
from jack_controller import jack_controller
from a2j_controller import a2j_controller
from ladish_controller import ladish_proxy
from .config import config
from .jack_configure import jack_configure
from .jack_controller import jack_controller
from .a2j_controller import a2j_controller
from .ladish_controller import ladish_proxy
# Default launcher menu :
menu_default = [{"Configure": "ladiconf"},
@ -239,7 +239,7 @@ class manager:
def on_menu_command(self, widget, function):
try:
function()
except Exception, e:
except Exception as e:
error = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, "Error executing " + repr(function) + "Unexpected error\n\n" + repr(e))
error.run()
error.destroy()
@ -259,8 +259,8 @@ class manager:
item.show()
menu.append(item)
item.connect("button-release-event", function, studio) # "activate" is not used because of focus bug in pygtk
except Exception, e:
print e
except Exception as e:
print(e)
self.menu_clear(menu)
item = gtk.MenuItem("Error obtaining studio list")
item.set_sensitive(False)
@ -284,8 +284,8 @@ class manager:
# Add the laucher entries at the beginning of the menu
for items in self.menu_array:
menu_label = items.keys()[0] + "..."
path = items.values()[0]
menu_label = list(items.keys())[0] + "..."
path = list(items.values())[0]
menu_items.append((gtk.ImageMenuItem(menu_label), self.on_menu_launcher, path))
menu = gtk.Menu()

View File

@ -36,7 +36,7 @@ class ladish_proxy:
try:
self.control_iface.IsStudioLoaded()
return True
except Exception, e:
except Exception as e:
#print repr(e)
return False