Handle window closes better
This commit is contained in:
parent
c5917b9df4
commit
2f991da6ea
@ -58,23 +58,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
|
||||
self.timer.start(Config.TIMER_MS)
|
||||
|
||||
def __del__(self):
|
||||
record = Settings.get_int("mainwindow_height")
|
||||
if record.f_int != self.height():
|
||||
record.update({'f_int': self.height()})
|
||||
|
||||
record = Settings.get_int("mainwindow_width")
|
||||
if record.f_int != self.width():
|
||||
record.update({'f_int': self.width()})
|
||||
|
||||
record = Settings.get_int("mainwindow_x")
|
||||
if record.f_int != self.x():
|
||||
record.update({'f_int': self.x()})
|
||||
|
||||
record = Settings.get_int("mainwindow_y")
|
||||
if record.f_int != self.y():
|
||||
record.update({'f_int': self.y()})
|
||||
|
||||
def add_file(self):
|
||||
dlg = QFileDialog()
|
||||
dlg.setFileMode(QFileDialog.ExistingFile)
|
||||
@ -96,6 +79,23 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
# TODO notify user
|
||||
else:
|
||||
DEBUG("closeEvent() accepted")
|
||||
|
||||
record = Settings.get_int("mainwindow_height")
|
||||
if record.f_int != self.height():
|
||||
record.update({'f_int': self.height()})
|
||||
|
||||
record = Settings.get_int("mainwindow_width")
|
||||
if record.f_int != self.width():
|
||||
record.update({'f_int': self.width()})
|
||||
|
||||
record = Settings.get_int("mainwindow_x")
|
||||
if record.f_int != self.x():
|
||||
record.update({'f_int': self.x()})
|
||||
|
||||
record = Settings.get_int("mainwindow_y")
|
||||
if record.f_int != self.y():
|
||||
record.update({'f_int': self.y()})
|
||||
|
||||
event.accept()
|
||||
|
||||
def connect_signals_slots(self):
|
||||
|
||||
@ -70,7 +70,7 @@ class Playlist(QTableWidget):
|
||||
self.previous_track_position = None
|
||||
self.played_tracks = []
|
||||
|
||||
def __del__(self):
|
||||
def closeEvent(self, event):
|
||||
"Save column widths"
|
||||
|
||||
for column in range(self.columnCount()):
|
||||
@ -80,6 +80,8 @@ class Playlist(QTableWidget):
|
||||
if record.f_int != self.columnWidth(column):
|
||||
record.update({'f_int': width})
|
||||
|
||||
event.accept()
|
||||
|
||||
def eventFilter(self, source, event):
|
||||
"Used to process context (right-click) menu"
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user