Kaydet (Commit) 3eb4d554 authored tarafından Hakan Dündar's avatar Hakan Dündar

Fix: Application crash after changing remembering last tabs

üst 1ee66745
...@@ -16,7 +16,7 @@ from Config import Config ...@@ -16,7 +16,7 @@ from Config import Config
from Performance import Performance from Performance import Performance
class MainWindow(Gtk.ApplicationWindow): class MainWindow():
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
...@@ -56,18 +56,6 @@ class MainWindow(Gtk.ApplicationWindow): ...@@ -56,18 +56,6 @@ class MainWindow(Gtk.ApplicationWindow):
# Connect GUI signals # Connect GUI signals
self.main_gui_connect_signals() self.main_gui_connect_signals()
# Run main tab function after main window is shown (this function is also called when main tab togglebuttons are toggled).
self.main_gui_tab_switch()
# Start the main loop function
self.main_gui_tab_loop()
# Hide Services tab if systemd is not used on the system.
self.main_gui_hide_services_tab()
# Check for updates (Python package only)
self.main_gui_check_for_updates()
def main_gui_main_window(self): def main_gui_main_window(self):
""" """
...@@ -75,7 +63,7 @@ class MainWindow(Gtk.ApplicationWindow): ...@@ -75,7 +63,7 @@ class MainWindow(Gtk.ApplicationWindow):
""" """
# Application window # Application window
self.main_window = self self.main_window = Gtk.ApplicationWindow()
#self.main_window.set_default_size(670, 570) #self.main_window.set_default_size(670, 570)
self.main_window.set_size_request(670, 570) self.main_window.set_size_request(670, 570)
self.main_window.set_title(_tr("System Monitoring Center")) self.main_window.set_title(_tr("System Monitoring Center"))
...@@ -626,7 +614,18 @@ class MainWindow(Gtk.ApplicationWindow): ...@@ -626,7 +614,18 @@ class MainWindow(Gtk.ApplicationWindow):
Some functions (such as hardware selection, performance backround function, etc.) Some functions (such as hardware selection, performance backround function, etc.)
are run after main window is shown in order to reduce window display delay. are run after main window is shown in order to reduce window display delay.
""" """
pass
# Run main tab function after main window is shown (this function is also called when main tab togglebuttons are toggled).
self.main_gui_tab_switch()
# Start the main loop function
self.main_gui_tab_loop()
# Hide Services tab if systemd is not used on the system.
self.main_gui_hide_services_tab()
# Check for updates (Python package only)
self.main_gui_check_for_updates()
def main_gui_main_menu(self): def main_gui_main_menu(self):
...@@ -1068,7 +1067,7 @@ class MainWindow(Gtk.ApplicationWindow): ...@@ -1068,7 +1067,7 @@ class MainWindow(Gtk.ApplicationWindow):
# Prevent error if this is the first tab switch and there is no scrolledwindow. # Prevent error if this is the first tab switch and there is no scrolledwindow.
except AttributeError: except AttributeError:
pass pass
tooltip_text = "-"
# Define variables for device list, selected device number and row number to be used for # Define variables for device list, selected device number and row number to be used for
# adding scrolledwindow into the grid. # adding scrolledwindow into the grid.
performance_tab_current_sub_tab = Config.performance_tab_current_sub_tab performance_tab_current_sub_tab = Config.performance_tab_current_sub_tab
......
...@@ -383,15 +383,15 @@ class SettingsWindow: ...@@ -383,15 +383,15 @@ class SettingsWindow:
# Get currently opened tabs and save them if preferred. # Get currently opened tabs and save them if preferred.
if widget.get_active() == True: if widget.get_active() == True:
Config.remember_last_opened_tabs_on_application_start = 1 Config.remember_last_opened_tabs_on_application_start = 1
self.combobox2003.set_sensitive(False) self.default_main_tab_cmb.set_sensitive(False)
self.combobox2004.set_sensitive(False) self.default_sub_tab_cmb.set_sensitive(False)
self.settings_gui_default_tab_func() self.settings_gui_default_tab_func()
# Set setting for not remembering las opened tabs if preferred. # Set setting for not remembering las opened tabs if preferred.
if widget.get_active() == False: if widget.get_active() == False:
Config.remember_last_opened_tabs_on_application_start = 0 Config.remember_last_opened_tabs_on_application_start = 0
self.combobox2003.set_sensitive(True) self.default_main_tab_cmb.set_sensitive(True)
self.combobox2004.set_sensitive(True) self.default_sub_tab_cmb.set_sensitive(True)
Config.config_save_func() Config.config_save_func()
...@@ -799,30 +799,30 @@ class SettingsWindow: ...@@ -799,30 +799,30 @@ class SettingsWindow:
# ----------------------- Called for saving default main tab and performace tab sub-tab when "Remember last opened tabs" option is enabled ----------------------- # ----------------------- Called for saving default main tab and performace tab sub-tab when "Remember last opened tabs" option is enabled -----------------------
def settings_gui_default_tab_func(self): def settings_gui_default_tab_func(self):
if MainWindow.radiobutton1.get_active() == True: if MainWindow.performance_tb.get_active() == True:
Config.default_main_tab = 0 Config.default_main_tab = 0
elif MainWindow.radiobutton2.get_active() == True: elif MainWindow.processes_tb.get_active() == True:
Config.default_main_tab = 1 Config.default_main_tab = 1
elif MainWindow.radiobutton3.get_active() == True: elif MainWindow.users_tb.get_active() == True:
Config.default_main_tab = 2 Config.default_main_tab = 2
elif MainWindow.radiobutton6.get_active() == True: elif MainWindow.services_tb.get_active() == True:
Config.default_main_tab = 3 Config.default_main_tab = 3
elif MainWindow.radiobutton8.get_active() == True: elif MainWindow.system_tb.get_active() == True:
Config.default_main_tab = 4 Config.default_main_tab = 4
if MainWindow.radiobutton1007.get_active() == True: if MainWindow.summary_tb.get_active() == True:
Config.performance_tab_default_sub_tab = 0 Config.performance_tab_default_sub_tab = 0
elif MainWindow.radiobutton1001.get_active() == True: elif MainWindow.cpu_tb.get_active() == True:
Config.performance_tab_default_sub_tab = 1 Config.performance_tab_default_sub_tab = 1
elif MainWindow.radiobutton1002.get_active() == True: elif MainWindow.memory_tb.get_active() == True:
Config.performance_tab_default_sub_tab = 2 Config.performance_tab_default_sub_tab = 2
elif MainWindow.radiobutton1003.get_active() == True: elif MainWindow.disk_tb.get_active() == True:
Config.performance_tab_default_sub_tab = 3 Config.performance_tab_default_sub_tab = 3
elif MainWindow.radiobutton1004.get_active() == True: elif MainWindow.network_tb.get_active() == True:
Config.performance_tab_default_sub_tab = 4 Config.performance_tab_default_sub_tab = 4
elif MainWindow.radiobutton1005.get_active() == True: elif MainWindow.gpu_tb.get_active() == True:
Config.performance_tab_default_sub_tab = 5 Config.performance_tab_default_sub_tab = 5
elif MainWindow.radiobutton1006.get_active() == True: elif MainWindow.sensors_tb.get_active() == True:
Config.performance_tab_default_sub_tab = 6 Config.performance_tab_default_sub_tab = 6
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment