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