From eeb5cc9ecb084fb3d15250540e634bc7f42f3bed Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Tue, 4 May 2021 17:17:26 -0500 Subject: [PATCH] Quieted most warnings & updated gtk methods --- linux/gui/kinto-gui.py | 106 ++++++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 50 deletions(-) diff --git a/linux/gui/kinto-gui.py b/linux/gui/kinto-gui.py index 863cfda..37c0b29 100755 --- a/linux/gui/kinto-gui.py +++ b/linux/gui/kinto-gui.py @@ -1,6 +1,8 @@ #!/usr/bin/env python3 import gi,os,time,fcntl,argparse,re +import warnings +warnings.filterwarnings("ignore") gi.require_version('Gtk', '3.0') gi.require_version('Vte', '2.91') from gi.repository import Gtk,Gdk,GdkPixbuf @@ -48,7 +50,7 @@ class MyWindow(Gtk.Window): page = 1 label = Gtk.Label() - label.set_alignment(1, 0) + label.set_halign(Gtk.Align.END) ostype = os.environ.get('XDG_CURRENT_DESKTOP') global openWin openWin = False @@ -195,19 +197,19 @@ class MyWindow(Gtk.Window): menubar.append(menuitem_edit) submenu_edit = Gtk.Menu() menuitem_edit.set_submenu(submenu_edit) - edititem_tweaks = Gtk.MenuItem("Tweaks") + edititem_tweaks = Gtk.MenuItem(label="Tweaks") edititem_tweaks.connect('activate',self.setTweaks) submenu_edit.append(edititem_tweaks) - edititem_config = Gtk.MenuItem("Kinto Config (shortcuts)") + edititem_config = Gtk.MenuItem(label="Kinto Config (shortcuts)") edititem_config.connect('activate',self.setConfig) submenu_edit.append(edititem_config) - edititem_service = Gtk.MenuItem("Kinto Service") + edititem_service = Gtk.MenuItem(label="Kinto Service") edititem_service.connect('activate',self.setService) submenu_edit.append(edititem_service) - edititem_shortcuts = Gtk.MenuItem("System Shortcuts") + edititem_shortcuts = Gtk.MenuItem(label="System Shortcuts") edititem_shortcuts.connect('activate',self.setSysKB) submenu_edit.append(edititem_shortcuts) - edititem_language = Gtk.MenuItem("Change Language") + edititem_language = Gtk.MenuItem(label="Change Language") edititem_language.connect('activate',self.setRegion) submenu_edit.append(edititem_language) @@ -221,11 +223,11 @@ class MyWindow(Gtk.Window): helpitem_debug = Gtk.MenuItem(label="Debug") helpitem_debug.connect('activate',self.runDebug) submenu_help.append(helpitem_debug) - helpitem_support = Gtk.MenuItem("Support") + helpitem_support = Gtk.MenuItem(label="Support") helpitem_support.connect('activate',self.openSupport) submenu_help.append(helpitem_support) menuitem_help.set_submenu(submenu_help) - helpitem_about = Gtk.MenuItem("About") + helpitem_about = Gtk.MenuItem(label="About") helpitem_about.connect('activate',self.runAbout) submenu_help.append(helpitem_about) @@ -433,21 +435,20 @@ class MyWindow(Gtk.Window): pixbuf = GdkPixbuf.Pixbuf.new_from_file(os.environ['HOME']+'/.config/kinto/gui/tuxcry4.png') pixbuf = pixbuf.scale_simple(600, 360, GdkPixbuf.InterpType.BILINEAR) self.bgsuccess4 = self.bgsuccess4.new_from_pixbuf(pixbuf) - self.bgsuccess4.set_alignment(0, 1) + self.bgsuccess4.set_valign(Gtk.Align.END) pixbuf = GdkPixbuf.Pixbuf.new_from_file(os.environ['HOME']+'/.config/kinto/gui/tuxuninstall.png') pixbuf = pixbuf.scale_simple(600, 360, GdkPixbuf.InterpType.BILINEAR) self.bguninstall = self.bguninstall.new_from_pixbuf(pixbuf) - self.bguninstall.set_alignment(0, 1) + self.bguninstall.set_valign(Gtk.Align.END) pixbuf = GdkPixbuf.Pixbuf.new_from_file(os.environ['HOME']+'/.config/kinto/gui/tuxbg.png') pixbuf = pixbuf.scale_simple(600, 360, GdkPixbuf.InterpType.BILINEAR) self.background = self.background.new_from_pixbuf(pixbuf) - self.background.set_alignment(0, 1) + self.background.set_valign(Gtk.Align.END) self.bgcaps = self.bgcaps.new_from_pixbuf(pixbuf2) - self.bgcaps.set_alignment(0, 1) self.bgspace = self.bgspace.new_from_pixbuf(pixbuf3) - self.bgspace.set_alignment(0, 1) + self.bgspace.set_valign(Gtk.Align.END) self.overlay.add(self.background) self.overlay.add_overlay(self.container) self.setupwin.add(self.container) @@ -1144,34 +1145,36 @@ class UninstallPage(Gtk.Box): label_start = Gtk.Label() label_start.set_markup('Uninstall\n\n\n\nWould you like to uninstall kinto?\n\n If you need support please visit kinto.sh.') - label_start.set_alignment(0,0) + label_start.set_valign(Gtk.Align.START) + label_start.set_halign(Gtk.Align.START) + label_start.set_line_wrap(True) vbox.add(label_start) scroller.add(vbox) hbox = Gtk.HBox() - previous = Gtk.Button("Uninstall") + previous = Gtk.Button(label="Uninstall") previous.connect("clicked", self.goback) - previous.set_margin_right(206) + previous.set_margin_end(206) hbox.add(previous) - onward = Gtk.Button("Continue") + onward = Gtk.Button(label="Continue") onward.connect("clicked", self.forward) hbox.add(onward) hbox.set_hexpand(False) hbox.set_vexpand(False) hbox.set_margin_bottom(6) - hbox.set_margin_right(25) + hbox.set_margin_end(25) scroller.set_hexpand(True) scroller.set_vexpand(True) vbox_container.add(scroller) vbox_container.set_margin_top(55) - vbox_container.set_margin_right(25) - self.grid.set_margin_left(157) + vbox_container.set_margin_end(25) + self.grid.set_margin_start(157) vbox_container.set_margin_bottom(18) - vbox.set_margin_right(10) + vbox.set_margin_end(10) vbox.set_margin_bottom(18) self.grid.add(vbox_container) self.grid.attach_next_to(hbox, vbox_container, Gtk.PositionType.BOTTOM, 2, 1) @@ -1203,18 +1206,19 @@ class FirstPage(Gtk.Box): label_start = Gtk.Label() label_start.set_markup("Before we continue please make sure you do not have any other remappers running. Kinto works best when it is the only application remapping your keys.\n\nBy continuing you also agree that Kinto is not held liable for any harm, damage(s) or unexpected behaviors.\nThis software is free, open-source, and provided as-is.\n\n© 2019, 2020 by Ben Reaves ~ Kinto is licensed on GPLv2.") - label_start.set_alignment(0,0) + label_start.set_valign(Gtk.Align.START) + label_start.set_halign(Gtk.Align.START) label_start.set_line_wrap(True) vbox.add(label_start) scroller.add(vbox) hbox = Gtk.HBox() - previous = Gtk.Button("") + previous = Gtk.Button(label="") for child in previous.get_children(): child.set_label("Decline") child.set_use_markup(True) previous.connect("clicked", self.goback) - previous.set_margin_right(245) + previous.set_margin_end(245) hbox.add(previous) self.__parent_window.first_onward.set_label("") @@ -1228,16 +1232,16 @@ class FirstPage(Gtk.Box): hbox.set_hexpand(False) hbox.set_vexpand(False) hbox.set_margin_bottom(6) - hbox.set_margin_right(25) + hbox.set_margin_end(25) scroller.set_hexpand(True) scroller.set_vexpand(True) vbox_container.add(scroller) vbox_container.set_margin_top(55) - vbox_container.set_margin_right(28) - self.grid.set_margin_left(157) + vbox_container.set_margin_end(28) + self.grid.set_margin_start(157) vbox_container.set_margin_bottom(18) - vbox.set_margin_right(10) + vbox.set_margin_end(10) vbox.set_margin_bottom(18) self.grid.add(vbox_container) self.grid.attach_next_to(hbox, vbox_container, Gtk.PositionType.BOTTOM, 2, 1) @@ -1276,37 +1280,38 @@ class SecondPage(Gtk.Box): label_start = Gtk.Label() label_start.set_markup('Identifying your Keyboard...\n\nPress the 2nd key Left of the spacebar.\n\nIf stuck here then unset Overlay (Super) key on your DE.') - label_start.set_alignment(0,0) + label_start.set_valign(Gtk.Align.START) + label_start.set_halign(Gtk.Align.START) label_start.set_line_wrap(True) vbox.add(label_start) scroller.add(vbox) hbox = Gtk.HBox() - previous = Gtk.Button("") + previous = Gtk.Button(label="") for child in previous.get_children(): child.set_label("Go Back") child.set_use_markup(True) previous.connect("clicked", self.goback) - previous.set_margin_right(315) + previous.set_margin_end(315) hbox.add(previous) - # onward = Gtk.Button("Continue") + # onward = Gtk.Button(label="Continue") # onward.connect("clicked", self.forward) # hbox.add(onward) hbox.set_hexpand(False) hbox.set_vexpand(False) hbox.set_margin_bottom(6) - hbox.set_margin_right(25) + hbox.set_margin_end(25) scroller.set_hexpand(True) scroller.set_vexpand(True) vbox_container.add(scroller) vbox_container.set_margin_top(55) - vbox_container.set_margin_right(25) - self.grid.set_margin_left(157) + vbox_container.set_margin_end(25) + self.grid.set_margin_start(157) vbox_container.set_margin_bottom(18) - vbox.set_margin_right(10) + vbox.set_margin_end(10) vbox.set_margin_bottom(18) self.grid.add(vbox_container) self.grid.attach_next_to(hbox, vbox_container, Gtk.PositionType.BOTTOM, 2, 1) @@ -1360,37 +1365,38 @@ class CapsPage(Gtk.Box): label_start = Gtk.Label() label_start.set_markup('Identifying your Keyboard...\n\nPress the capslock key twice.') - label_start.set_alignment(0,0) + label_start.set_valign(Gtk.Align.START) + label_start.set_halign(Gtk.Align.START) label_start.set_line_wrap(True) vbox.add(label_start) scroller.add(vbox) hbox = Gtk.HBox() - previous = Gtk.Button("") + previous = Gtk.Button(label="") for child in previous.get_children(): child.set_label("Go Back") child.set_use_markup(True) previous.connect("clicked", self.goback) - previous.set_margin_right(315) + previous.set_margin_end(315) hbox.add(previous) - # onward = Gtk.Button("Continue") + # onward = Gtk.Button(label="Continue") # onward.connect("clicked", self.forward) # hbox.add(onward) hbox.set_hexpand(False) hbox.set_vexpand(False) hbox.set_margin_bottom(6) - hbox.set_margin_right(25) + hbox.set_margin_end(25) scroller.set_hexpand(True) scroller.set_vexpand(True) vbox_container.add(scroller) vbox_container.set_margin_top(55) - vbox_container.set_margin_right(25) - self.grid.set_margin_left(157) + vbox_container.set_margin_end(25) + self.grid.set_margin_start(157) vbox_container.set_margin_bottom(18) - vbox.set_margin_right(10) + vbox.set_margin_end(10) vbox.set_margin_bottom(18) self.grid.add(vbox_container) self.grid.attach_next_to(hbox, vbox_container, Gtk.PositionType.BOTTOM, 2, 1) @@ -1427,9 +1433,9 @@ class SuccessPage(Gtk.Box): self.grid = Gtk.Grid() hbox = Gtk.HBox() - previous = Gtk.Button(" ") + previous = Gtk.Button(label=" ") previous.props.relief = Gtk.ReliefStyle.NONE - previous.set_margin_right(245) + previous.set_margin_end(245) hbox.add(previous) self.__parent_window.last_onward.set_label("") @@ -1442,7 +1448,7 @@ class SuccessPage(Gtk.Box): hbox.set_hexpand(False) hbox.set_vexpand(False) hbox.set_margin_bottom(6) - hbox.set_margin_right(25) + hbox.set_margin_end(25) scroller = Gtk.ScrolledWindow() scroller.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.NEVER) @@ -1451,11 +1457,11 @@ class SuccessPage(Gtk.Box): vbox = Gtk.VBox() vbox_container = Gtk.VBox() vbox_container.set_margin_top(55) - vbox_container.set_margin_right(28) + vbox_container.set_margin_end(28) vbox_container.add(scroller) - self.grid.set_margin_left(157) + self.grid.set_margin_start(157) vbox_container.set_margin_bottom(18) - vbox.set_margin_right(10) + vbox.set_margin_end(10) vbox.set_margin_bottom(18) self.grid.add(vbox_container) self.grid.attach_next_to(hbox, vbox_container, Gtk.PositionType.BOTTOM, 2, 1)