Example #1
0
    def on_tab_change(self, notebook, page, page_num):
        """
        Callback method handling tab changes.
        
        @param notebook - the notebook instance
        @param page - notebookpage 
        @param page_num - number of the current page 
        
        """
        #load favorites and recent servers directly if switched to
        #these tabs
        gc = GuiController()
        if 1 == page_num:  #favorites
            #gc.loadFavorites(self.favoritestab)
            gc.executeFavoritesLoading(self.favoritestab)
            self.favoritestab.filter.lock()
        if 2 == page_num:  #recent server
            #gc.loadRecentServer(self.recenttab)
            gc.executeRecentServersLoading(self.recenttab)
            self.recenttab.filter.lock()
        if 3 == page_num:  #buddies tab
            fm = FileManager()
            config = fm.getConfiguration()
            execute = fm.value_as_boolean(config[cfgkey.OPT_BUDDYSEARCH])
            if self.first_switch and execute:
                gc.execute_buddies_loading(self.buddiestab, execute=True)
            else:
                gc.execute_buddies_loading(self.buddiestab)

        self.first_switch = False
Example #2
0
 def on_tab_change(self, notebook, page, page_num):
     """
     Callback method handling tab changes.
     
     @param notebook - the notebook instance
     @param page - notebookpage 
     @param page_num - number of the current page 
     
     """
     #load favorites and recent servers directly if switched to
     #these tabs 
     gc = GuiController()
     if 1 == page_num: #favorites
         #gc.loadFavorites(self.favoritestab)
         gc.executeFavoritesLoading(self.favoritestab)
         self.favoritestab.filter.lock()
     if 2 == page_num: #recent server
         #gc.loadRecentServer(self.recenttab)
         gc.executeRecentServersLoading(self.recenttab)
         self.recenttab.filter.lock()
     if 3 == page_num: #buddies tab
         fm = FileManager()
         config = fm.getConfiguration()
         execute = fm.value_as_boolean(config[cfgkey.OPT_BUDDYSEARCH])
         if self.first_switch and execute:
             gc.execute_buddies_loading(self.buddiestab, execute=True)
         else:
             gc.execute_buddies_loading(self.buddiestab)
              
     self.first_switch = False
Example #3
0
    def initialize_from_stored_filter_settings(self):
        """
        Uses the stored filter settings provided by the FileManager to
        initialize the values of the filter
        """
        fm = FileManager()
        sf = fm.get_remembered_filter_parameters()

        self.show_empty = fm.value_as_boolean(sf[filterkey.QRY_SHOW_EMPTY])
        self.show_full = fm.value_as_boolean(sf[filterkey.QRY_SHOW_FULL])

        self.hide_non_responsive = fm.value_as_boolean(sf[filterkey.\
                                                             FLT_HIDE_NON_RESP])
        self.hide_passworded = fm.value_as_boolean(sf[filterkey.\
                                                           FLT_HIDE_PASSWORDED])

        self.min_players = int(sf[filterkey.FLT_MIN_PLAYERS])
        self.max_players = int(sf[filterkey.FLT_MAX_PLAYERS])

        self.gametype_bomb = fm.value_as_boolean(sf[filterkey.GT_BOMB])
        self.gametype_ts = fm.value_as_boolean(sf[filterkey.GT_TS])
        self.gametype_ctf = fm.value_as_boolean(sf[filterkey.GT_CTF])
        self.gametype_tdm = fm.value_as_boolean(sf[filterkey.GT_TDM])
        self.gametype_cah = fm.value_as_boolean(sf[filterkey.GT_CAH])
        self.gametype_ftl = fm.value_as_boolean(sf[filterkey.GT_FTL])
        self.gametype_ffa = fm.value_as_boolean(sf[filterkey.GT_FFA])

        if filterkey.FLT_MAP_NAME in sf:
            self.map_name = sf[filterkey.FLT_MAP_NAME]

        if filterkey.FLT_SERVER_NAME in sf:
            self.server_name = sf[filterkey.FLT_SERVER_NAME]

        if filterkey.FLT_GEAR in sf:
            self.gear_filter_type = sf[filterkey.FLT_GEAR]

        if filterkey.FLT_GEAR_LIST in sf:
            self.gear_value_list = sf[filterkey.FLT_GEAR_LIST]

        if filterkey.FLT_VAR_LIST in sf:
            self.server_var_list = sf[filterkey.FLT_VAR_LIST]
Example #4
0
    def set_defaults(self):
        """
        Set ui input element values to the values read from configuration
        """
        fm = FileManager()
        config = fm.getConfiguration()

        self.exe_entry.set_text(config[cfgkey.URT_EXE])
        self.path_entry.set_text(config[cfgkey.URT_EXE_PATH])
        self.addcmd_entry.set_text(config[cfgkey.URT_EXE_PARAMS])

        defaulttab = int(config[cfgkey.OPT_DEFAULT_TAB])
        if 0 == defaulttab:
            self.srvlist_radio.set_active(True)
            self.checkbox_buddysearch.set_sensitive(False)
            self.checkbox_buddysearch.set_active(False)
        elif 1 == defaulttab:
            self.favlist_radio.set_active(True)
            self.checkbox_buddysearch.set_sensitive(False)
            self.checkbox_buddysearch.set_active(False)
        elif 2 == defaulttab:
            self.reclist_radio.set_active(True)
            self.checkbox_buddysearch.set_sensitive(False)
            self.checkbox_buddysearch.set_active(False)
        elif 3 == defaulttab:
            self.buddies_radio.set_active(True)
            self.checkbox_buddysearch.set_sensitive(True)
            self.checkbox_buddysearch.set_active(fm.value_as_boolean(\
                                                config[cfgkey.OPT_BUDDYSEARCH]))
        else:
            self.srvlist_radio.set_active(True)

        if cfgvalues.BASIC_FILTER == config[cfgkey.OPT_FILTER]:
            self.filter_basic_radio.set_active(True)
            self.filter_advanced_radio.set_active(False)
        elif cfgvalues.ADVANCED_FILTER == config[cfgkey.OPT_FILTER]:
            self.filter_basic_radio.set_active(False)
            self.filter_advanced_radio.set_active(True)
        else:  #fallback to basic
            self.filter_basic_radio.set_active(True)
            self.filter_advanced_radio.set_active(False)
Example #5
0
    def set_defaults(self):
        """
        Set ui input element values to the values read from configuration
        """
        fm = FileManager()
        config = fm.getConfiguration()

        self.exe_entry.set_text(config[cfgkey.URT_EXE])
        self.path_entry.set_text(config[cfgkey.URT_EXE_PATH])
        self.addcmd_entry.set_text(config[cfgkey.URT_EXE_PARAMS])

        defaulttab = int(config[cfgkey.OPT_DEFAULT_TAB])
        if 0 == defaulttab:
            self.srvlist_radio.set_active(True)
            self.checkbox_buddysearch.set_sensitive(False)
            self.checkbox_buddysearch.set_active(False)
        elif 1 == defaulttab:
            self.favlist_radio.set_active(True)
            self.checkbox_buddysearch.set_sensitive(False)
            self.checkbox_buddysearch.set_active(False)
        elif 2 == defaulttab:
            self.reclist_radio.set_active(True)
            self.checkbox_buddysearch.set_sensitive(False)
            self.checkbox_buddysearch.set_active(False)
        elif 3 == defaulttab:
            self.buddies_radio.set_active(True)
            self.checkbox_buddysearch.set_sensitive(True)
            self.checkbox_buddysearch.set_active(fm.value_as_boolean(config[cfgkey.OPT_BUDDYSEARCH]))
        else:
            self.srvlist_radio.set_active(True)

        if cfgvalues.BASIC_FILTER == config[cfgkey.OPT_FILTER]:
            self.filter_basic_radio.set_active(True)
            self.filter_advanced_radio.set_active(False)
        elif cfgvalues.ADVANCED_FILTER == config[cfgkey.OPT_FILTER]:
            self.filter_basic_radio.set_active(False)
            self.filter_advanced_radio.set_active(True)
        else:  # fallback to basic
            self.filter_basic_radio.set_active(True)
            self.filter_advanced_radio.set_active(False)
Example #6
0
    def set_default_values(self, reset):
        """
        Set default values to all input elements of the filter.
        Differs between application defaults and the values that are stored
        in a file to remember user choices.
        
        @param reset - boolean: if True use application defaults, otherwise load
                       values from file. 
       
        """

        fm = FileManager()
        stored_filter = fm.get_remembered_filter_parameters()

        if reset or None == stored_filter:  #reset to application defaults
            self.gametypes.checkbox_show_gametype_all.set_active(True)
            # emits the 'toggled' signal
            self.gametypes.checkbox_show_gametype_all.toggled()

            self.checkbox_hide_non_responsive.set_active(True)
            self.checkbox_hide_passworded.set_active(True)

            #defaults for min and maxplayer spinbuttons
            self.minplayerentry.set_value(0)
            self.maxplayerentry.set_value(99)

            self.checkbox_showfull.set_active(False)
            self.checkbox_showempty.set_active(False)
        else:  #reset to stored values

            #gametypes
            value = fm.value_as_boolean(stored_filter[filterkey.GT_ALL])
            self.gametypes.checkbox_show_gametype_all.set_active(True)

            value = fm.value_as_boolean(stored_filter[filterkey.GT_BOMB])
            self.gametypes.checkbox_show_gametype_bomb.set_active(value)

            value = fm.value_as_boolean(stored_filter[filterkey.GT_TS])
            self.gametypes.checkbox_show_gametype_survivor.set_active(value)

            value = fm.value_as_boolean(stored_filter[filterkey.GT_CTF])
            self.gametypes.checkbox_show_gametype_ctf.set_active(value)

            value = fm.value_as_boolean(stored_filter[filterkey.GT_TDM])
            self.gametypes.checkbox_show_gametype_tdm.set_active(value)

            value = fm.value_as_boolean(stored_filter[filterkey.GT_CAH])
            self.gametypes.checkbox_show_gametype_cah.set_active(value)

            value = fm.value_as_boolean(stored_filter[filterkey.GT_FTL])
            self.gametypes.checkbox_show_gametype_ftl.set_active(value)

            value = fm.value_as_boolean(stored_filter[filterkey.GT_FFA])
            self.gametypes.checkbox_show_gametype_ffa.set_active(value)

            #other filters:
            #defaults for min and maxplayer spinbuttons
            value = int(stored_filter[filterkey.FLT_MIN_PLAYERS])
            self.minplayerentry.set_value(value)

            value = int(stored_filter[filterkey.FLT_MAX_PLAYERS])
            self.maxplayerentry.set_value(value)

            value = fm.value_as_boolean(stored_filter[filterkey.\
                                                             FLT_HIDE_NON_RESP])
            self.checkbox_hide_non_responsive.set_active(value)

            value = fm.value_as_boolean(stored_filter[filterkey.\
                                                           FLT_HIDE_PASSWORDED])
            self.checkbox_hide_passworded.set_active(value)

            #query params
            value = fm.value_as_boolean(stored_filter[filterkey.QRY_SHOW_FULL])
            self.checkbox_showfull.set_active(value)

            value = fm.value_as_boolean(
                stored_filter[filterkey.QRY_SHOW_EMPTY])
            self.checkbox_showempty.set_active(value)
Example #7
0
    def set_default_values(self, reset):
        """
        Set default values to all input elements of the filter.
        Differs between application defaults and the values that are stored
        in a file to remember user choices.
        
        @param reset - boolean: if True use application defaults, otherwise load
                       values from file. 
       
        """

        self.gearliststore.clear()
        self.cvarliststore.clear()

        fm = FileManager()
        stored_filter = fm.get_remembered_filter_parameters()

        #gearcheckbox is not stored, only the listview
        #initialize with all checked
        self.checkbox_grenades.set_active(True)
        self.checkbox_snipers.set_active(True)
        self.checkbox_spas.set_active(True)
        self.checkbox_pistols.set_active(True)
        self.checkbox_automatics.set_active(True)
        self.checkbox_negev.set_active(True)

        if reset or None == stored_filter:  #reset to application defaults
            self.gametypesfilter.checkbox_show_gametype_all.set_active(True)
            # emits the 'toggled' signal
            self.gametypesfilter.checkbox_show_gametype_all.toggled()

            self.checkbox_hide_non_responsive.set_active(True)
            self.checkbox_hide_passworded.set_active(True)

            #defaults for min and maxplayer spinbuttons
            self.minplayerentry.set_value(0)
            self.maxplayerentry.set_value(99)

            self.checkbox_showfull.set_active(False)
            self.checkbox_showempty.set_active(False)

            self.mapnameentry.set_text('')
            self.servernameentry.set_text('')
        else:  #reset to stored values

            #gametypes
            value = fm.value_as_boolean(stored_filter[filterkey.GT_ALL])
            self.gametypesfilter.checkbox_show_gametype_all.set_active(True)

            value = fm.value_as_boolean(stored_filter[filterkey.GT_BOMB])
            self.gametypesfilter.checkbox_show_gametype_bomb.set_active(value)

            value = fm.value_as_boolean(stored_filter[filterkey.GT_TS])
            self.gametypesfilter.checkbox_show_gametype_survivor.set_active(
                value)

            value = fm.value_as_boolean(stored_filter[filterkey.GT_CTF])
            self.gametypesfilter.checkbox_show_gametype_ctf.set_active(value)

            value = fm.value_as_boolean(stored_filter[filterkey.GT_TDM])
            self.gametypesfilter.checkbox_show_gametype_tdm.set_active(value)

            value = fm.value_as_boolean(stored_filter[filterkey.GT_CAH])
            self.gametypesfilter.checkbox_show_gametype_cah.set_active(value)

            value = fm.value_as_boolean(stored_filter[filterkey.GT_FTL])
            self.gametypesfilter.checkbox_show_gametype_ftl.set_active(value)

            value = fm.value_as_boolean(stored_filter[filterkey.GT_FFA])
            self.gametypesfilter.checkbox_show_gametype_ffa.set_active(value)

            #other filters:
            #defaults for min and maxplayer spinbuttons
            value = int(stored_filter[filterkey.FLT_MIN_PLAYERS])
            self.minplayerentry.set_value(value)

            value = int(stored_filter[filterkey.FLT_MAX_PLAYERS])
            self.maxplayerentry.set_value(value)

            if filterkey.FLT_MAP_NAME in stored_filter:
                self.mapnameentry.set_text(stored_filter[filterkey.\
                                                                  FLT_MAP_NAME])
            if filterkey.FLT_SERVER_NAME in stored_filter:
                self.servernameentry.set_text(stored_filter[filterkey.\
                                                               FLT_SERVER_NAME])

            value = fm.value_as_boolean(stored_filter[filterkey.\
                                                             FLT_HIDE_NON_RESP])
            self.checkbox_hide_non_responsive.set_active(value)

            value = fm.value_as_boolean(stored_filter[filterkey.\
                                                           FLT_HIDE_PASSWORDED])
            self.checkbox_hide_passworded.set_active(value)

            #query params
            value = fm.value_as_boolean(stored_filter[filterkey.QRY_SHOW_FULL])
            self.checkbox_showfull.set_active(value)

            value = fm.value_as_boolean(
                stored_filter[filterkey.QRY_SHOW_EMPTY])
            self.checkbox_showempty.set_active(value)

            #the gearvalue list
            if filterkey.FLT_GEAR in stored_filter:
                value = stored_filter[filterkey.FLT_GEAR]
                if cfgvalues.DISABLED == value:
                    self.radio_gear_disable.set_active(True)
                    self.radio_gear_exclude.set_active(False)
                    self.radio_gear_include.set_active(False)
                elif cfgvalues.INCLUDE == value:
                    self.radio_gear_disable.set_active(False)
                    self.radio_gear_exclude.set_active(False)
                    self.radio_gear_include.set_active(True)
                elif cfgvalues.EXCLUDE == value:
                    self.radio_gear_disable.set_active(False)
                    self.radio_gear_exclude.set_active(True)
                    self.radio_gear_include.set_active(False)

            if filterkey.FLT_GEAR_LIST in stored_filter:
                for value in stored_filter[filterkey.FLT_GEAR_LIST]:
                    self.gearliststore.append([value])

            if filterkey.FLT_VAR_LIST in stored_filter:
                for value in stored_filter[filterkey.FLT_VAR_LIST]:
                    self.cvarliststore.append([value[0], value[1], \
                                               value[2], value])
Example #8
0
 def set_default_values(self, reset):
     """
     Set default values to all input elements of the filter.
     Differs between application defaults and the values that are stored
     in a file to remember user choices.
     
     @param reset - boolean: if True use application defaults, otherwise load
                    values from file. 
    
     """
     
     self.gearliststore.clear()
     self.cvarliststore.clear()
     
     fm = FileManager()
     stored_filter = fm.get_remembered_filter_parameters()
     
     #gearcheckbox is not stored, only the listview
     #initialize with all checked
     self.checkbox_grenades.set_active(True)
     self.checkbox_snipers.set_active(True)
     self.checkbox_spas.set_active(True)
     self.checkbox_pistols.set_active(True)
     self.checkbox_automatics.set_active(True)
     self.checkbox_negev.set_active(True)
     
     
     if reset or None == stored_filter: #reset to application defaults            
         self.gametypesfilter.checkbox_show_gametype_all.set_active(True)
         # emits the 'toggled' signal
         self.gametypesfilter.checkbox_show_gametype_all.toggled() 
         
         self.checkbox_hide_non_responsive.set_active(True)
         self.checkbox_hide_passworded.set_active(True)
         
         #defaults for min and maxplayer spinbuttons
         self.minplayerentry.set_value(0)
         self.maxplayerentry.set_value(99)
         
         self.checkbox_showfull.set_active(False)
         self.checkbox_showempty.set_active(False)
         
         self.mapnameentry.set_text('')
         self.servernameentry.set_text('')
     else: #reset to stored values
         
         #gametypes
         value = fm.value_as_boolean(stored_filter[filterkey.GT_ALL])
         self.gametypesfilter.checkbox_show_gametype_all.set_active(True)
         
         value = fm.value_as_boolean(stored_filter[filterkey.GT_BOMB])
         self.gametypesfilter.checkbox_show_gametype_bomb.set_active(value)
         
         value = fm.value_as_boolean(stored_filter[filterkey.GT_TS])
         self.gametypesfilter.checkbox_show_gametype_survivor.set_active(value)
         
         value = fm.value_as_boolean(stored_filter[filterkey.GT_CTF])
         self.gametypesfilter.checkbox_show_gametype_ctf.set_active(value)
         
         value = fm.value_as_boolean(stored_filter[filterkey.GT_TDM])
         self.gametypesfilter.checkbox_show_gametype_tdm.set_active(value)
         
         value = fm.value_as_boolean(stored_filter[filterkey.GT_CAH])
         self.gametypesfilter.checkbox_show_gametype_cah.set_active(value)
         
         value = fm.value_as_boolean(stored_filter[filterkey.GT_FTL])
         self.gametypesfilter.checkbox_show_gametype_ftl.set_active(value)
         
         value = fm.value_as_boolean(stored_filter[filterkey.GT_FFA])
         self.gametypesfilter.checkbox_show_gametype_ffa.set_active(value)
         
         #other filters:
         #defaults for min and maxplayer spinbuttons
         value = int(stored_filter[filterkey.FLT_MIN_PLAYERS])
         self.minplayerentry.set_value(value)
         
         value = int(stored_filter[filterkey.FLT_MAX_PLAYERS])
         self.maxplayerentry.set_value(value)
         
         if filterkey.FLT_MAP_NAME in stored_filter:
             self.mapnameentry.set_text(stored_filter[filterkey.\
                                                               FLT_MAP_NAME])
         if filterkey.FLT_SERVER_NAME in stored_filter:
             self.servernameentry.set_text(stored_filter[filterkey.\
                                                            FLT_SERVER_NAME])
         
         value = fm.value_as_boolean(stored_filter[filterkey.\
                                                          FLT_HIDE_NON_RESP])
         self.checkbox_hide_non_responsive.set_active(value)
         
         value = fm.value_as_boolean(stored_filter[filterkey.\
                                                        FLT_HIDE_PASSWORDED])
         self.checkbox_hide_passworded.set_active(value)
         
         #query params
         value = fm.value_as_boolean(stored_filter[filterkey.QRY_SHOW_FULL])
         self.checkbox_showfull.set_active(value)
         
         value = fm.value_as_boolean(stored_filter[filterkey.QRY_SHOW_EMPTY])
         self.checkbox_showempty.set_active(value)
         
         #the gearvalue list
         if filterkey.FLT_GEAR in stored_filter:
             value = stored_filter[filterkey.FLT_GEAR]
             if cfgvalues.DISABLED == value:
                 self.radio_gear_disable.set_active(True)
                 self.radio_gear_exclude.set_active(False)
                 self.radio_gear_include.set_active(False)
             elif cfgvalues.INCLUDE == value:
                 self.radio_gear_disable.set_active(False)
                 self.radio_gear_exclude.set_active(False)
                 self.radio_gear_include.set_active(True)
             elif cfgvalues.EXCLUDE == value:
                 self.radio_gear_disable.set_active(False)
                 self.radio_gear_exclude.set_active(True)
                 self.radio_gear_include.set_active(False)
         
         if filterkey.FLT_GEAR_LIST in stored_filter:
             for value in stored_filter[filterkey.FLT_GEAR_LIST]:
                 self.gearliststore.append([value])
                 
         if filterkey.FLT_VAR_LIST in stored_filter:
             for value in stored_filter[filterkey.FLT_VAR_LIST]:
                 self.cvarliststore.append([value[0], value[1], \
                                            value[2], value])
Example #9
0
 def set_default_values(self, reset):
     """
     Set default values to all input elements of the filter.
     Differs between application defaults and the values that are stored
     in a file to remember user choices.
     
     @param reset - boolean: if True use application defaults, otherwise load
                    values from file. 
    
     """
     
     fm = FileManager()
     stored_filter = fm.get_remembered_filter_parameters()
     
     if reset or None == stored_filter: #reset to application defaults            
         self.gametypes.checkbox_show_gametype_all.set_active(True)
         # emits the 'toggled' signal
         self.gametypes.checkbox_show_gametype_all.toggled() 
         
         self.checkbox_hide_non_responsive.set_active(True)
         self.checkbox_hide_passworded.set_active(True)
         
         #defaults for min and maxplayer spinbuttons
         self.minplayerentry.set_value(0)
         self.maxplayerentry.set_value(99)
         
         self.checkbox_showfull.set_active(False)
         self.checkbox_showempty.set_active(False)
     else: #reset to stored values
         
         #gametypes
         value = fm.value_as_boolean(stored_filter[filterkey.GT_ALL])
         self.gametypes.checkbox_show_gametype_all.set_active(True)
         
         value = fm.value_as_boolean(stored_filter[filterkey.GT_BOMB])
         self.gametypes.checkbox_show_gametype_bomb.set_active(value)
         
         value = fm.value_as_boolean(stored_filter[filterkey.GT_TS])
         self.gametypes.checkbox_show_gametype_survivor.set_active(value)
         
         value = fm.value_as_boolean(stored_filter[filterkey.GT_CTF])
         self.gametypes.checkbox_show_gametype_ctf.set_active(value)
         
         value = fm.value_as_boolean(stored_filter[filterkey.GT_TDM])
         self.gametypes.checkbox_show_gametype_tdm.set_active(value)
         
         value = fm.value_as_boolean(stored_filter[filterkey.GT_CAH])
         self.gametypes.checkbox_show_gametype_cah.set_active(value)
         
         value = fm.value_as_boolean(stored_filter[filterkey.GT_FTL])
         self.gametypes.checkbox_show_gametype_ftl.set_active(value)
         
         value = fm.value_as_boolean(stored_filter[filterkey.GT_FFA])
         self.gametypes.checkbox_show_gametype_ffa.set_active(value)
         
         #other filters:
         #defaults for min and maxplayer spinbuttons
         value = int(stored_filter[filterkey.FLT_MIN_PLAYERS])
         self.minplayerentry.set_value(value)
         
         value = int(stored_filter[filterkey.FLT_MAX_PLAYERS])
         self.maxplayerentry.set_value(value)
         
         value = fm.value_as_boolean(stored_filter[filterkey.\
                                                          FLT_HIDE_NON_RESP])
         self.checkbox_hide_non_responsive.set_active(value)
         
         value = fm.value_as_boolean(stored_filter[filterkey.\
                                                        FLT_HIDE_PASSWORDED])
         self.checkbox_hide_passworded.set_active(value)
         
         #query params
         value = fm.value_as_boolean(stored_filter[filterkey.QRY_SHOW_FULL])
         self.checkbox_showfull.set_active(value)
         
         value = fm.value_as_boolean(stored_filter[filterkey.QRY_SHOW_EMPTY])
         self.checkbox_showempty.set_active(value)