Fixed some bugs regarding escaped chars; Moved signal handler to Window
This commit is contained in:
@@ -5,13 +5,11 @@
|
||||
import argparse
|
||||
import faulthandler
|
||||
from setproctitle import setproctitle
|
||||
import signal
|
||||
|
||||
# Gtk imports
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import GLib
|
||||
|
||||
# Application imports
|
||||
from __builtins__ import *
|
||||
@@ -23,7 +21,7 @@ from app import Application
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
setproctitle('{app_name}')
|
||||
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, Gtk.main_quit)
|
||||
|
||||
faulthandler.enable() # For better debug info
|
||||
parser = argparse.ArgumentParser()
|
||||
# Add long and short arguments
|
||||
|
||||
@@ -147,4 +147,4 @@ class ChangeView(Gtk.Box, CommonWidgetGeneratorMixin, CommonActionsMixin):
|
||||
return int(text) if text.isdigit() else text
|
||||
|
||||
def _natural_keys(self, text):
|
||||
return [ self._atoi(c) for c in re.split('(\d+)',text) ]
|
||||
return [ self._atoi(c) for c in re.split(r'(\d+)',text) ]
|
||||
|
||||
@@ -61,7 +61,7 @@ class MoveSubstring(Gtk.Box, CommonWidgetGeneratorMixin, CommonActionsMixin):
|
||||
fsub = self.entry_from.get_text()
|
||||
tsub = self.entry_to.get_text()
|
||||
|
||||
print(f"From: {fsub}\nTo: {tsub}\Move To index: {insert_index}")
|
||||
print(f"From: {fsub}\nTo: {tsub}\nMove To index: {insert_index}")
|
||||
for name in to_changes:
|
||||
try:
|
||||
startIndex = name.index(f"{fsub}")
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
|
||||
# Python imports
|
||||
import signal
|
||||
|
||||
# Lib imports
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import GLib
|
||||
|
||||
# Application imports
|
||||
from .controller import Controller
|
||||
@@ -18,11 +17,14 @@ class Window(Gtk.Window):
|
||||
def __init__(self, args, unknownargs):
|
||||
super(Window, self).__init__()
|
||||
|
||||
self.add(Controller(args, unknownargs))
|
||||
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, Gtk.main_quit)
|
||||
|
||||
self.connect("delete-event", Gtk.main_quit)
|
||||
self.set_default_size(850, 600)
|
||||
self.set_title(f"{app_name}")
|
||||
self.set_icon_from_file("/usr/share/bulkr/bulkr.png")
|
||||
self.set_gravity(5) # 5 = CENTER
|
||||
self.set_position(1) # 1 = CENTER, 4 = CENTER_ALWAYS
|
||||
|
||||
self.add(Controller(args, unknownargs))
|
||||
self.show_all()
|
||||
|
||||
Reference in New Issue
Block a user