Exemplo n.º 1
0
    def __init__(self, parent, title, message):
        """ Constructor

        Parameters
        ----------
        parent : Gtk.Window
            Parent object
        title : str
            Dialog title
        message : str
            Dialog message
        """

        classic_theme = False
        if parent is not None:
            classic_theme = parent.use_classic_theme

        CommonWindow.__init__(self, parent, title, Icons.Symbolic.QUESTION,
                              classic_theme)

        # ------------------------------------
        #   Variables
        # ------------------------------------

        self.message = message

        # ------------------------------------
        #   Prepare interface
        # ------------------------------------

        # Init widgets
        self.__init_widgets()

        # Start interface
        self.__start_interface()
Exemplo n.º 2
0
Arquivo: cache.py Projeto: pingax/gem
    def __init__(self, parent):
        """ Constructor

        Parameters
        ----------
        parent : Gtk.Window
            Parent object
        """

        classic_theme = False
        if parent is not None:
            classic_theme = parent.use_classic_theme

        CommonWindow.__init__(self, parent, _("Clean icons cache"),
                              Icons.Symbolic.FOLDER, classic_theme)

        # ------------------------------------
        #   Prepare interface
        # ------------------------------------

        # Init widgets
        self.__init_widgets()

        # Start interface
        self.__start_interface()
Exemplo n.º 3
0
    def __init__(self, parent, title, path, folder):
        """ Constructor

        Parameters
        ----------
        parent : Gtk.Window
            Parent object
        title : str
            Window title
        path : str
            Selected icon path
        folder : str
            Icons folder
        """

        CommonWindow.__init__(self,
                              parent,
                              title,
                              Icons.Symbolic.IMAGE,
                              parent.use_classic_theme)

        # ------------------------------------
        #   Variables
        # ------------------------------------

        self.api = parent.api

        self.icons = parent.icons

        # Current file path
        self.path = path
        # The new file path
        self.new_path = None

        # File selector management
        self.__file_path = None
        self.__file_active = False

        # Collection type
        self.folder = folder

        # Collection thread loading instance
        self.thread = int()

        # ------------------------------------
        #   Initialization
        # ------------------------------------

        # Init widgets
        self.__init_widgets()

        # Init packing
        self.__init_packing()

        # Init signals
        self.__init_signals()

        # Start interface
        self.__start_interface()
Exemplo n.º 4
0
    def __init__(self, parent, title):
        """ Constructor

        Parameters
        ----------
        parent : Gtk.Window
            Parent object
        title : str
            Window title
        """

        classic_theme = False
        if parent is not None:
            classic_theme = parent.use_classic_theme

        CommonWindow.__init__(self,
                              parent,
                              title,
                              Icons.Symbolic.SEND,
                              classic_theme)

        # ------------------------------------
        #   Variables
        # ------------------------------------

        self.mimetypes = ["text/plain"]

        # ------------------------------------
        #   Targets
        # ------------------------------------

        self.targets = [Gtk.TargetEntry.new("text/uri-list", 0, 1337)]

        # ------------------------------------
        #   Prepare interface
        # ------------------------------------

        # Init widgets
        self.__init_widgets()

        # Init signals
        self.__init_signals()

        # Start interface
        self.__start_interface()
Exemplo n.º 5
0
Arquivo: cover.py Projeto: pingax/gem
    def __init__(self, parent, game):
        """ Constructor

        Parameters
        ----------
        parent : Gtk.Window
            Parent object
        game : gem.api.Game
            Game object instance
        """

        classic_theme = False
        if parent is not None:
            classic_theme = parent.use_classic_theme

        CommonWindow.__init__(
            self, parent, _("Game cover"), Icons.Symbolic.IMAGE, classic_theme)

        # ------------------------------------
        #   Initialize variables
        # ------------------------------------

        self.game = game

        self.mimetypes = [
            "image/bmp",
            "image/jpeg",
            "image/png",
            "image/svg+xml",
            "image/svg+xml-compressed",
        ]

        # ------------------------------------
        #   Prepare interface
        # ------------------------------------

        # Init widgets
        self.__init_widgets()

        # Init signals
        self.__init_signals()

        # Start interface
        self.__start_interface()
Exemplo n.º 6
0
    def __init__(self, parent, title, path=None):
        """ Constructor

        Parameters
        ----------
        parent : Gtk.Window
            Parent object
        title : str
            Window title
        path : str, optional
            Set a default path in import filechooser widget
        """

        classic_theme = False
        if parent is not None:
            classic_theme = parent.use_classic_theme

        CommonWindow.__init__(self,
                              parent,
                              title,
                              Icons.Symbolic.SAVE_AS,
                              classic_theme)

        # ------------------------------------
        #   Variables
        # ------------------------------------

        self.path = path

        self.mimetypes = ["text/plain"]

        # ------------------------------------
        #   Prepare interface
        # ------------------------------------

        # Init widgets
        self.__init_widgets()

        # Init signals
        self.__init_signals()

        # Start interface
        self.__start_interface()
Exemplo n.º 7
0
    def __init__(self, parent, name, data):
        """ Constructor

        Parameters
        ----------
        parent : Gtk.Window
            Parent object
        name : str
            Game name
        data : dict
            Backup memory type dictionary (with type as key)
        """

        classic_theme = False
        if parent is not None:
            classic_theme = parent.use_classic_theme

        CommonWindow.__init__(self, parent, _("Backup Memory Type"),
                              Icons.Symbolic.SAVE, classic_theme)

        # ------------------------------------
        #   Initialize variables
        # ------------------------------------

        self.data = data

        self.name = name

        self.memory_list = ["eeprom", "flash", "rtc", "sensor", "sram"]

        # ------------------------------------
        #   Prepare interface
        # ------------------------------------

        # Init widgets
        self.__init_widgets()

        # Init signals
        self.__init_signals()

        # Start interface
        self.__start_interface()
Exemplo n.º 8
0
    def __init__(self, parent, title, message, icon, center=True):
        """ Constructor

        Parameters
        ----------
        parent : Gtk.Window
            Parent object
        title : str
            Dialog title
        message : str
            Dialog message
        icon : str
            Default icon name
        center : bool, optional
            If False, use justify text insted of center (Default: True)
        """

        classic_theme = False
        if parent is not None:
            classic_theme = parent.use_classic_theme

        CommonWindow.__init__(self, parent, title, icon, classic_theme)

        # ------------------------------------
        #   Initialize variables
        # ------------------------------------

        self.message = message

        self.center = center

        # ------------------------------------
        #   Prepare interface
        # ------------------------------------

        # Init widgets
        self.__init_widgets()

        # Start interface
        self.__start_interface()
Exemplo n.º 9
0
    def __init__(self, parent, filepaths):
        """ Constructor

        Parameters
        ----------
        parent : Gtk.Window
            Parent object
        filepaths : dict
            Filepaths storage with corresponding consoles
        """

        classic_theme = False
        if parent is not None:
            classic_theme = parent.use_classic_theme

        CommonWindow.__init__(self, parent, _("Drag & Drop"),
                              Icons.Symbolic.GAMING, classic_theme)

        # ----------------------------------------
        #   Initialize variables
        # ----------------------------------------

        self.api = parent.api

        self.filepaths = filepaths

        self.__notebook_pages = dict()

        # ----------------------------------------
        #   Prepare interface
        # ----------------------------------------

        # Init widgets
        self.__init_widgets()

        # Init signals
        self.__init_signals()

        # Start interface
        self.__start_interface()
Exemplo n.º 10
0
    def __init__(self, parent, game):
        """ Constructor

        Parameters
        ----------
        parent : Gtk.Window
            Parent object
        game : gem.engine.game.Game
            Game object
        """

        classic_theme = False
        if parent is not None:
            classic_theme = parent.use_classic_theme

        CommonWindow.__init__(self,
                              parent,
                              _("Remove a game"),
                              Icons.Symbolic.DELETE,
                              classic_theme)

        # ------------------------------------
        #   Variables
        # ------------------------------------

        self.game = game

        # ------------------------------------
        #   Prepare interface
        # ------------------------------------

        # Init widgets
        self.__init_widgets()

        # Init signals
        self.__init_signals()

        # Start interface
        self.__start_interface()
Exemplo n.º 11
0
    def __init__(self, parent, game):
        """ Constructor

        Parameters
        ----------
        parent : Gtk.Window
            Parent object
        game : gem.engine.game.Game
            Game object
        """

        classic_theme = False
        if parent is not None:
            classic_theme = parent.use_classic_theme

        CommonWindow.__init__(self, parent, _("Game properties"),
                              Icons.Symbolic.GAMING, classic_theme)

        # ------------------------------------
        #   Initialize variables
        # ------------------------------------

        self.interface = parent

        self.api = parent.api
        self.icons = parent.icons

        self.game = game

        self.help_data = {
            "order": [
                _("Description"),
                _("Parameters"),
            ],
            _("Description"): [
                _("Emulator default arguments can use custom parameters to "
                  "facilitate file detection."),
                _("Nintendo console titles are identified by a 6 character "
                  "identifier known as a GameID. This GameID is only used "
                  "with some emulators like Dolphin-emu. For more "
                  "informations, consult emulators documentation."),
                _("Tags are split by commas.")
            ],
            _("Parameters"): {
                "<key>": _("Use game key"),
                "<name>": _("Use ROM filename"),
                "<lname>": _("Use ROM lowercase filename"),
                "<rom_path>": _("Use ROM folder path"),
                "<rom_file>": _("Use ROM file path"),
                "<conf_path>": _("Use emulator configuration file path"),
            }
        }

        # ------------------------------------
        #   Prepare interface
        # ------------------------------------

        # Init widgets
        self.__init_widgets()

        # Init signals
        self.__init_signals()

        # Start interface
        self.__start_interface()
Exemplo n.º 12
0
    def __init__(self, parent, title, file_path, size, icon, editable=True):
        """ Constructor

        Parameters
        ----------
        parent : Gtk.Window
            Parent object
        title : str
            Dialog title
        file_path : str
            File path
        size : (int, int)
            Dialog size
        icon : gem.data.Icons
            Default icon name
        editable : bool, optional
            If True, allow to modify and save text buffer to file_path
            (Default: True)
        """

        classic_theme = False
        if parent is not None:
            classic_theme = parent.use_classic_theme

        CommonWindow.__init__(self, parent, title, icon, classic_theme)

        # ------------------------------------
        #   Initialize variables
        # ------------------------------------

        if type(editable) is not bool:
            raise TypeError("Wrong type for editable, expected bool")

        self.path = file_path
        self.editable = editable
        self.__width, self.__height = size

        self.founded_iter = list()
        self.current_index = int()
        self.previous_search = str()

        self.modified_buffer = False
        self.refresh_buffer = True

        # ------------------------------------
        #   Targets
        # ------------------------------------

        self.targets = [Gtk.TargetEntry.new("text/uri-list", 0, 1337)]

        # ------------------------------------
        #   Prepare interface
        # ------------------------------------

        # Init widgets
        self.__init_widgets()

        # Init signals
        self.__init_signals()

        # Start interface
        self.__start_interface()
Exemplo n.º 13
0
Arquivo: viewer.py Projeto: pingax/gem
    def __init__(self, parent, title, size, screenshots_path):
        """ Constructor

        Parameters
        ----------
        parent : Gtk.Window
            Parent object
        title : str
            Dialog title
        size : (int, int)
            Dialog size
        screenshots_path : list
            Screnshots path list
        """

        classic_theme = False
        if parent is not None:
            classic_theme = parent.use_classic_theme

        CommonWindow.__init__(self, parent, title, Icons.IMAGE, classic_theme)

        # ------------------------------------
        #   Initialize variables
        # ------------------------------------

        self.index = 0

        self.zoom_fit = True

        self.zoom_min = 10
        self.zoom_max = 400
        self.zoom_step = 5
        self.zoom_page_step = 10
        self.zoom_actual = 100

        # Allow the picture to autosize (with zoom_fit) when resize dialog
        self.auto_resize = parent.config.getboolean("viewer",
                                                    "auto_resize",
                                                    fallback=False)

        self.screenshots = screenshots_path

        self.current_path = None
        self.current_pixbuf = None
        self.current_pixbuf_zoom = None
        self.current_pixbuf_size = tuple()

        self.targets = parent.targets

        self.__width, self.__height = size

        # ------------------------------------
        #   Manage monitor geometry
        # ------------------------------------

        self.__default_size = 800

        # Get default display
        display = Gdk.Display.get_default()

        if display is not None:
            # Retrieve default display monitor
            monitor = display.get_primary_monitor()
            # Retrieve default monitor geometry
            geometry = monitor.get_geometry()

            self.__default_size = min(int(geometry.width / 2),
                                      int(geometry.height / 2))

        # ------------------------------------
        #   Prepare interface
        # ------------------------------------

        # Init widgets
        self.__init_widgets()

        # Init signals
        self.__init_signals()

        # Start interface
        self.__start_interface()
Exemplo n.º 14
0
    def __init__(self, parent, console, consoles, emulators):
        """ Constructor

        Parameters
        ----------
        parent : Gtk.Window
            Parent object (Default: None)
        console : gem.engine.console.Console
            Console object
        emulators : list
            Emulator objects storage
        """

        CommonWindow.__init__(self,
                              parent,
                              _("Console"),
                              Icons.Symbolic.GAMING,
                              parent.use_classic_theme)

        # ------------------------------------
        #   Initialize variables
        # ------------------------------------

        # GEM API instance
        self.api = parent.api
        # Console object
        self.console = console

        # Consoles storage
        self.consoles = consoles
        # Emulators storage
        self.emulators = emulators

        # GEM config
        self.config = parent.config

        self.path = None

        self.error = False
        self.file_error = False
        self.emulator_error = False

        if getattr(parent, "interface", None) is not None:
            self.interface = parent.interface

        else:
            self.interface = parent

        # Empty Pixbuf icon
        self.icons = parent.icons

        self.help_data = {
            "order": [
                "Description",
                "Extensions",
                _("Extensions examples"),
                "Expressions"
            ],
            "Description": [
                _("A console represent a games library. You can specify a "
                  "default emulator which is used by this console and "
                  "extensions which is readable by this emulator.")
            ],
            "Extensions": [
                _("Most of the time, extensions are common between differents "
                  "emulators and represent the console acronym name (example: "
                  "Nintendo NES -> nes)."),
                _("Extensions are split by spaces and must not have the first "
                  "dot (using \"nes\" than \".nes\").")
            ],
            _("Extensions examples"): {
                "Nintendo NES": "nes",
                "Sega Megadrive": "md smd bin 32x md cue"
            },
            "Expressions": [
                _("It's possible to hide specific files from the games list "
                  "with regular expressions.")
            ]
        }

        # ------------------------------------
        #   Prepare interface
        # ------------------------------------

        # Init widgets
        self.__init_widgets()

        # Init packing
        self.__init_packing()

        # Init signals
        self.__init_signals()

        # Start interface
        self.__start_interface()
Exemplo n.º 15
0
    def __init__(self, parent, emulator, emulators):
        """ Constructor

        Parameters
        ----------
        parent : Gtk.Window
            Parent object
        emulator : gem.engine.emulator.Emulator
            Emulator object
        modify : bool
            Use edit mode instead of append mode
        """

        CommonWindow.__init__(self, parent, _("Emulator"),
                              Icons.Symbolic.PROPERTIES,
                              parent.use_classic_theme)

        # ------------------------------------
        #   Initialize variables
        # ------------------------------------

        # GEM API instance
        self.api = parent.api
        # Emulator object
        self.emulator = emulator

        # Consoles storage
        self.emulators = emulators

        # GEM config
        self.config = parent.config

        self.path = None

        self.error = False

        if getattr(parent, "interface", None) is not None:
            self.interface = parent.interface

        else:
            self.interface = parent

        # Empty Pixbuf icon
        self.icons = parent.icons

        self.help_data = {
            "order": [
                _("Description"),
                _("Parameters"),
            ],
            _("Description"): [
                _("To facilitate file detection with every emulators, some "
                  "custom parameters have been created."),
                _("These parameters are used in \"Default options\", \"Save\" "
                  "and \"Snapshots\" entries."),
            ],
            _("Parameters"): {
                "<key>": _("Use game key"),
                "<name>": _("Use ROM filename"),
                "<lname>": _("Use ROM lowercase filename"),
                "<rom_path>": _("Use ROM folder path"),
                "<rom_file>": _("Use ROM file path"),
                "<conf_path>": _("Use emulator configuration file path"),
            }
        }

        # ------------------------------------
        #   Prepare interface
        # ------------------------------------

        # Init widgets
        self.__init_widgets()

        # Init packing
        self.__init_packing()

        # Init signals
        self.__init_signals()

        # Start interface
        self.__start_interface()