예제 #1
0
 def select_dir(button):
     new_directory = dir_chooser_dialog.get_filename()
     engine = discoverer.getEngineByName(self.cur_engine)
     old_directory = engine.get("workingDirectory")
     if new_directory != old_directory and new_directory != self.default_workdir:
         engine["workingDirectory"] = new_directory
         discoverer.save()
예제 #2
0
 def select_dir(button):
     new_directory = dir_chooser_dialog.get_filename()
     engine = discoverer.getEngineByName(self.cur_engine)
     old_directory = engine.get("workingDirectory")
     if new_directory != old_directory and new_directory != self.default_workdir:
         engine["workingDirectory"] = new_directory
         discoverer.save()
예제 #3
0
 def spin_edited_cb(self, cell, path, new_text, model):
     try:
         model[path][1]["value"] = int(new_text)
         discoverer.save()
     except Exception:
         pass
     return
예제 #4
0
 def args_changed(widget):
     if self.cur_engine is not None:
         new_args = self.widgets["engine_args_entry"].get_text().strip()
         engine = discoverer.getEngineByName(self.cur_engine)
         old_args = engine.get("args")
         if new_args != old_args:
             engine["args"] = new_args.split()
             discoverer.save()
예제 #5
0
 def args_changed(widget):
     if self.cur_engine is not None:
         new_args = self.widgets["engine_args_entry"].get_text().strip()
         engine = discoverer.getEngineByName(self.cur_engine)
         old_args = engine.get("args")
         if new_args != old_args:
             engine["args"] = new_args.split()
             discoverer.save()
예제 #6
0
 def remove(button):
     if self.cur_engine is not None:
         self.widgets['remove_engine_button'].set_sensitive(False)
         engine = discoverer.getEngineByName(self.cur_engine)
         discoverer.removeEngine(self.cur_engine)
         discoverer.save()
         update_store(discoverer)
         # Notify playerCombos in NewGameTasker
         discoverer.emit("all_engines_discovered")
         ts = self.tv.get_selection()
         ts.select_path((0,))
예제 #7
0
 def remove(button):
     if self.cur_engine is not None:
         self.widgets['remove_engine_button'].set_sensitive(False)
         engine = discoverer.getEngineByName(self.cur_engine)
         discoverer.removeEngine(self.cur_engine)
         discoverer.save()
         update_store(discoverer)
         # Notify playerCombos in NewGameTasker
         discoverer.emit("all_engines_discovered")
         ts = self.tv.get_selection()
         ts.select_path((0, ))
예제 #8
0
 def name_edited(renderer, path, new_name):
     if self.cur_engine is not None:
         old_name = self.cur_engine
         if new_name and new_name != old_name:
             names = [engine["name"] for engine in discoverer.getEngines()]
             if new_name not in names:
                 engine = discoverer.getEngineByName(self.cur_engine)
                 engine["name"] = new_name
                 discoverer.save()
                 self.cur_engine = new_name
                 update_store()                        
                 # Notify playerCombos in NewGameTasker
                 discoverer.emit("all_engines_discovered")
예제 #9
0
 def name_edited(renderer, path, new_name):
     if self.cur_engine is not None:
         old_name = self.cur_engine
         if new_name and new_name != old_name:
             names = [engine["name"] for engine in discoverer.getEngines()]
             if new_name not in names:
                 engine = discoverer.getEngineByName(self.cur_engine)
                 engine["name"] = new_name
                 discoverer.save()
                 self.cur_engine = new_name
                 update_store()                        
                 # Notify playerCombos in NewGameTasker
                 discoverer.emit("all_engines_discovered")
예제 #10
0
        def remove(button):
            if self.cur_engine is not None:
                self.widgets['remove_engine_button'].set_sensitive(False)
                # engine = discoverer.getEngineByName(self.cur_engine)
                discoverer.removeEngine(self.cur_engine)
                discoverer.save()

                selection = self.tv.get_selection()
                result = selection.get_selected()
                if result is not None:
                    model, ts_iter = result
                    model.remove(ts_iter)

                # Notify playerCombos in NewGameTasker
                discoverer.emit("all_engines_discovered")
예제 #11
0
 def engine_default_options(button):
     if self.cur_engine is not None and not self.selection:
         engine = discoverer.getEngineByName(self.cur_engine)
         options = engine.get("options")
         if options:
             dialog = Gtk.MessageDialog(mainwindow(), type=Gtk.MessageType.QUESTION, buttons=Gtk.ButtonsType.YES_NO)
             dialog.set_markup(_("Do you really want to restore the default options of the engine ?"))
             response = dialog.run()
             dialog.destroy()
             if response == Gtk.ResponseType.YES:
                 for option in options:
                     if "default" in option:
                         option["value"] = option["default"]
                 discoverer.save()
                 update_options()
예제 #12
0
        def remove(button):
            if self.cur_engine is not None:
                self.widgets['remove_engine_button'].set_sensitive(False)
                engine = discoverer.getEngineByName(self.cur_engine)
                discoverer.removeEngine(self.cur_engine)
                discoverer.save()

                selection = self.tv.get_selection()
                result = selection.get_selected()
                if result is not None:
                    model, iter = result
                    model.remove(iter)

                # Notify playerCombos in NewGameTasker
                discoverer.emit("all_engines_discovered")
예제 #13
0
        def cancel_event(widget, with_confirmation, *args):
            # Confirm if the changes need to be saved
            modified = discoverer.hasChanged()
            if modified and with_confirmation:
                dialog = Gtk.MessageDialog(mainwindow(), type=Gtk.MessageType.QUESTION, buttons=Gtk.ButtonsType.YES_NO)
                dialog.set_markup(_("You have unsaved changes. Do you want to save before leaving?"))
                response = dialog.run()
                dialog.destroy()
                # if response == Gtk.ResponseType.CANCEL:
                #    return False
                if response == Gtk.ResponseType.NO:
                    discoverer.restore()
                if response == Gtk.ResponseType.YES:
                    discoverer.save()

            # Close the window
            widgets["manage_engines_dialog"].hide()
            return True
예제 #14
0
 def engine_default_options(button):
     if self.cur_engine is not None and not self.selection:
         engine = discoverer.getEngineByName(self.cur_engine)
         options = engine.get("options")
         if options:
             dialog = Gtk.MessageDialog(mainwindow(),
                                        type=Gtk.MessageType.QUESTION,
                                        buttons=Gtk.ButtonsType.YES_NO)
             dialog.set_markup(
                 _("Do you really want to restore the default options of the engine ?"
                   ))
             response = dialog.run()
             dialog.destroy()
             if response == Gtk.ResponseType.YES:
                 for option in options:
                     if "default" in option:
                         option["value"] = option["default"]
                 discoverer.save()
                 update_options()
예제 #15
0
        def country_changed(widget):
            if self.cur_engine is not None and not self.selection:
                engine = discoverer.getEngineByName(self.cur_engine)
                old_country = discoverer.getCountry(engine)
                new_country = ISO3166_LIST[widget.get_active()].iso2
                if old_country != new_country:
                    engine["country"] = new_country
                    discoverer.save()

                    # Refresh the flag in the tree view
                    path = addDataPrefix("flags/%s.png" % new_country)
                    if not os.path.isfile(path):
                        path = addDataPrefix("flags/unknown.png")
                    item = self.tv.get_selection().get_selected()
                    if item is not None:
                        model, ts_iter = item
                        model[ts_iter][0] = get_pixbuf(path)

                        # Notify playerCombos in NewGameTasker
                        discoverer.emit("all_engines_discovered")
예제 #16
0
        def country_changed(widget):
            if self.cur_engine is not None and not self.selection:
                engine = discoverer.getEngineByName(self.cur_engine)
                old_country = discoverer.getCountry(engine)
                new_country = ISO3166_LIST[widget.get_active()].iso2
                if old_country != new_country:
                    engine["country"] = new_country
                    discoverer.save()

                    # Refresh the flag in the tree view
                    path = addDataPrefix("flags/%s.png" % new_country)
                    if not os.path.isfile(path):
                        path = addDataPrefix("flags/unknown.png")
                    item = self.tv.get_selection().get_selected()
                    if item is not None:
                        model, ts_iter = item
                        model[ts_iter][0] = get_pixbuf(path)

                        # Notify playerCombos in NewGameTasker
                        discoverer.emit("all_engines_discovered")
예제 #17
0
 def spin_edited_cb(self, cell, path, new_text, model):
     model[path][1]["value"] = new_text
     discoverer.save()
     return
예제 #18
0
 def toggled_cb(self, cell, path, model):
     model[path][1]["value"] = not model[path][1]["value"]
     discoverer.save()
     return
예제 #19
0
 def save_event(widget, *args):
     discoverer.save()
     widgets["manage_engines_dialog"].hide()
     return True
예제 #20
0
 def spin_edited_cb(self, cell, path, new_text, model):
     model[path][1]["value"] = new_text
     discoverer.save()
     return
예제 #21
0
 def toggled_cb(self, cell, path, model):
     model[path][1]["value"] = not model[path][1]["value"]
     discoverer.save()
     return
예제 #22
0
 def save_event(widget, *args):
     discoverer.save()
     widgets["manage_engines_dialog"].hide()
     return True