Skip to content

Commit

Permalink
Connect to signals of the shown window
Browse files Browse the repository at this point in the history
In the case of OnboardingWindow and MainWindow, the class itself is not
shown as a window, but its 'window' field is shown, so when the window
is closed, the application does not terminate - the wrong signals is
connected to the handler.
  • Loading branch information
Gliese852 committed Nov 7, 2023
1 parent c5b1766 commit a8c9e7c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions howdy-gtk/src/onboarding.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ def __init__(self):
# Make the class a GTK window
gtk.Window.__init__(self)

self.connect("destroy", self.exit)
self.connect("delete_event", self.exit)

self.builder = gtk.Builder()
self.builder.add_from_file(paths_factory.onboarding_wireframe_path())
self.builder.connect_signals(self)

self.window = self.builder.get_object("onboardingwindow")
self.nextbutton = self.builder.get_object("nextbutton")

self.window.connect("destroy", self.exit)
self.window.connect("delete_event", self.exit)

self.slides = [
self.builder.get_object("slide0"),
self.builder.get_object("slide1"),
Expand Down Expand Up @@ -317,7 +317,7 @@ def show_error(self, error, secon=""):
dialog.destroy()
self.exit()

def exit(self, widget=None):
def exit(self, widget, context):
"""Cleanly exit"""
gtk.main_quit()
sys.exit(0)
6 changes: 3 additions & 3 deletions howdy-gtk/src/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ def __init__(self):
# Make the class a GTK window
gtk.Window.__init__(self)

self.connect("destroy", self.exit)
self.connect("delete_event", self.exit)

self.builder = gtk.Builder()
self.builder.add_from_file(paths_factory.main_window_wireframe_path())
self.builder.connect_signals(self)
Expand All @@ -35,6 +32,9 @@ def __init__(self):
self.modellistbox = self.builder.get_object("modellistbox")
self.opencvimage = self.builder.get_object("opencvimage")

self.window.connect("destroy", self.exit)
self.window.connect("delete_event", self.exit)

# Init capture for video tab
self.capture = None

Expand Down

0 comments on commit a8c9e7c

Please sign in to comment.