Ejemplo n.º 1
0
    def __init__(self, argv, locale=None, gui=True):
        """Initialize our QApplication for translation
        """
        i18n.install(locale)
        qtcompat.install()

        # Add the default style dir so that we find our icons
        icon_dir = resources.icon_dir()
        qtcompat.add_search_path(os.path.basename(icon_dir), icon_dir)

        # monkey-patch Qt's translate() to use our translate()
        if gui:
            self._app = instance(tuple(argv))
            self._app.setWindowIcon(qtutils.git_icon())
            self._translate_base = QtGui.QApplication.translate
            QtGui.QApplication.translate = self.translate
        else:
            self._app = QtCore.QCoreApplication(argv)
            self._translate_base = QtCore.QCoreApplication.translate
            QtCore.QCoreApplication.translate = self.translate

        # Register model commands
        cmds.register()

        # Make file descriptors binary for win32
        utils.set_binary(sys.stdin)
        utils.set_binary(sys.stdout)
        utils.set_binary(sys.stderr)
Ejemplo n.º 2
0
    def __init__(self, argv, locale=None, gui=True):
        """Initialize our QApplication for translation
        """
        i18n.install(locale)
        qtcompat.install()

        # Add the default style dir so that we find our icons
        icon_dir = resources.icon_dir()
        qtcompat.add_search_path(os.path.basename(icon_dir), icon_dir)

        # monkey-patch Qt's translate() to use our translate()
        if gui:
            self._app = instance(tuple(argv))
            self._app.setWindowIcon(qtutils.git_icon())
            self._translate_base = QtGui.QApplication.translate
            QtGui.QApplication.translate = self.translate
        else:
            self._app = QtCore.QCoreApplication(argv)
            self._translate_base = QtCore.QCoreApplication.translate
            QtCore.QCoreApplication.translate = self.translate

        # Register model commands
        cmds.register()

        # Make file descriptors binary for win32
        utils.set_binary(sys.stdin)
        utils.set_binary(sys.stdout)
        utils.set_binary(sys.stderr)
Ejemplo n.º 3
0
    def __init__(self, argv, locale=None, gui=True):
        """Initialize our QApplication for translation
        """
        cfgactions.install()
        i18n.install(locale)
        qtcompat.install()
        qtutils.install()

        # Add the default style dir so that we find our icons
        icon_dir = resources.icon_dir()
        qtcompat.add_search_path(os.path.basename(icon_dir), icon_dir)

        # monkey-patch Qt's translate() to use our translate()
        if gui:
            self._app = instance(tuple(argv))
            self._app.setWindowIcon(qtutils.git_icon())
            self._translate_base = QtGui.QApplication.translate
            QtGui.QApplication.translate = self.translate
        else:
            self._app = QtCore.QCoreApplication(argv)
            self._translate_base = QtCore.QCoreApplication.translate
            QtCore.QCoreApplication.translate = self.translate
            if not hasattr(self._app, 'setStyleSheet'):
                self._app.setStyleSheet = lambda x: None

        self._app.setStyleSheet("""
            QMainWindow::separator {
                width: 3px;
                height: 3px;
            }
            QMainWindow::separator:hover {
                background: white;
            }
            """)

        # Make file descriptors binary for win32
        utils.set_binary(sys.stdin)
        utils.set_binary(sys.stdout)
        utils.set_binary(sys.stderr)
Ejemplo n.º 4
0
    def __init__(self, argv, locale=None, gui=True):
        """Initialize our QApplication for translation
        """
        cfgactions.install()
        i18n.install(locale)
        qtcompat.install()
        qtutils.install()

        # Add the default style dir so that we find our icons
        icon_dir = resources.icon_dir()
        qtcompat.add_search_path(os.path.basename(icon_dir), icon_dir)

        # monkey-patch Qt's translate() to use our translate()
        if gui:
            self._app = instance(tuple(argv))
            self._app.setWindowIcon(qtutils.git_icon())
            self._translate_base = QtGui.QApplication.translate
            QtGui.QApplication.translate = self.translate
        else:
            self._app = QtCore.QCoreApplication(argv)
            self._translate_base = QtCore.QCoreApplication.translate
            QtCore.QCoreApplication.translate = self.translate

        self._app.setStyleSheet("""
            QMainWindow::separator {
                width: 3px;
                height: 3px;
            }
            QMainWindow::separator:hover {
                background: white;
            }
            """)

        # Make file descriptors binary for win32
        utils.set_binary(sys.stdin)
        utils.set_binary(sys.stdout)
        utils.set_binary(sys.stderr)