예제 #1
0
파일: app.py 프로젝트: forfolias/git-cola
    def __init__(self, argv, locale=None, gui=True, git_path=None):
        cfgactions.install()
        i18n.install(locale)
        qtcompat.install()
        qtutils.install()

        # Call _update_files when inotify detects changes
        inotify.observer(_update_files)

        # 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)

        if gui:
            self._app = instance(tuple(argv), git_path)
            self._app.setWindowIcon(qtutils.git_icon())
        else:
            self._app = QtCore.QCoreApplication(argv)

        self._app.setStyleSheet("""
            QMainWindow::separator {
                width: 3px;
                height: 3px;
            }
            QMainWindow::separator:hover {
                background: white;
            }
            """)
예제 #2
0
 def test_translates_english_noun(self):
     """Test that English strings with @@noun are properly handled
     """
     i18n.install("en_US.UTF-8")
     expect = "Commit"
     actual = N_("Commit@@noun")
     self.assertEqual(expect, actual)
예제 #3
0
 def test_translates_random_english(self):
     """Test that random English strings are passed through as-is
     """
     i18n.install('en_US.UTF-8')
     expect = 'Random'
     actual = N_('Random')
     self.assertEqual(expect, actual)
예제 #4
0
 def test_translates_verb(self):
     """Test that strings with @@verb are translated
     """
     i18n.install("de_DE")
     expect = "Eintragen"
     actual = N_("Commit@@verb")
     self.assertEqual(expect, actual)
예제 #5
0
파일: app.py 프로젝트: yjpark/git-cola
    def __init__(self, argv, locale=None, gui=True):
        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)

        if gui:
            self._app = instance(tuple(argv))
            self._app.setWindowIcon(qtutils.git_icon())
        else:
            self._app = QtCore.QCoreApplication(argv)

        self._app.setStyleSheet("""
            QMainWindow::separator {
                width: 3px;
                height: 3px;
            }
            QMainWindow::separator:hover {
                background: white;
            }
            """)
예제 #6
0
파일: app.py 프로젝트: kensholiu/git-cola
    def __init__(self, argv, locale=None, gui=True):
        cfgactions.install()
        i18n.install(locale)
        qtcompat.install()
        qtutils.install()
        icons.install()

        self.notifier = QtCore.QObject()
        self.notifier.connect(self.notifier, SIGNAL('update_files()'),
                              self._update_files, Qt.QueuedConnection)
        # Call _update_files when inotify detects changes
        inotify.observer(self._update_files_notifier)

        if gui:
            self._app = current(tuple(argv))
            self._app.setWindowIcon(icons.cola())
            self._app.setStyleSheet("""
                QMainWindow::separator {
                    width: 3px;
                    height: 3px;
                }
                QMainWindow::separator:hover {
                    background: white;
                }
                """)
        else:
            self._app = QtCore.QCoreApplication(argv)
예제 #7
0
 def test_translates_verb(self):
     """Test that strings with @@verb are translated
     """
     i18n.install('de_DE')
     expect = 'Version aufnehmen'
     actual = N_('Commit@@verb')
     self.assertEqual(expect, actual)
예제 #8
0
 def test_translates_english_verb(self):
     """Test that English strings with @@verb are properly handled
     """
     i18n.install('en_US.UTF-8')
     expect = 'Commit'
     actual = N_('Commit@@verb')
     self.assertEqual(expect, actual)
예제 #9
0
 def test_guards_against_qstring(self):
     """Test that random QString is passed through as-is
     """
     i18n.install('en_US.UTF-8')
     expect = 'Random'
     actual = i18n.gettext(QtCore.QString('Random'))
     self.assertEqual(expect, actual)
예제 #10
0
 def test_translates_noun(self):
     """Test that strings with @@noun are translated
     """
     i18n.install("ja_JP")
     expect = unichr(0x30B3) + unichr(0x30DF) + unichr(0x30C3) + unichr(0x30C8)
     actual = N_("Commit@@noun")
     self.assertEqual(expect, actual)
예제 #11
0
파일: app.py 프로젝트: Jobava/git-cola
    def __init__(self, argv, locale=None, gui=True):
        cfgactions.install()
        i18n.install(locale)
        qtcompat.install()
        qtutils.install()

        self.notifier = QtCore.QObject()
        self.notifier.connect(self.notifier, SIGNAL("update_files()"), self._update_files, Qt.QueuedConnection)
        # Call _update_files when inotify detects changes
        inotify.observer(self._update_files_notifier)

        # 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)

        if gui:
            self._app = current(tuple(argv))
            self._app.setWindowIcon(qtutils.git_icon())
            self._app.setStyleSheet(
                """
                QMainWindow::separator {
                    width: 3px;
                    height: 3px;
                }
                QMainWindow::separator:hover {
                    background: white;
                }
                """
            )
        else:
            self._app = QtCore.QCoreApplication(argv)
예제 #12
0
파일: app.py 프로젝트: adrlwill/git-cola
    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)
예제 #13
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)
예제 #14
0
파일: app.py 프로젝트: jmcabandara/git-cola
    def __init__(self, argv, locale=None, gui=True, git_path=None):
        cfgactions.install()
        i18n.install(locale)
        qtcompat.install()
        qtutils.install()

        self.notifier = QtCore.QObject()
        self.notifier.connect(self.notifier, SIGNAL('update_files'),
                              self._update_files)
        # Call _update_files when inotify detects changes
        inotify.observer(self._update_files_notifier)

        # 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)

        if gui:
            self._app = current(tuple(argv), git_path)
            self._app.setWindowIcon(qtutils.git_icon())
            self._app.setStyleSheet("""
                QMainWindow::separator {
                    width: 3px;
                    height: 3px;
                }
                QMainWindow::separator:hover {
                    background: white;
                }
                """)
        else:
            self._app = QtCore.QCoreApplication(argv)
예제 #15
0
파일: app.py 프로젝트: Chetwyn/git-cola
    def __init__(self, argv, locale=None, gui=True):
        cfgactions.install()
        i18n.install(locale)
        qtcompat.install()
        qtutils.install()
        icons.install()

        self.notifier = QtCore.QObject()
        self.notifier.connect(self.notifier, SIGNAL('update_files()'),
                              self._update_files, Qt.QueuedConnection)
        # Call _update_files when inotify detects changes
        inotify.observer(self._update_files_notifier)

        if gui:
            self._app = current(tuple(argv))
            self._app.setWindowIcon(icons.cola())
            self._app.setStyleSheet("""
                QMainWindow::separator {
                    width: 3px;
                    height: 3px;
                }
                QMainWindow::separator:hover {
                    background: white;
                }
                """)
        else:
            self._app = QtCore.QCoreApplication(argv)
예제 #16
0
 def test_translates_verb(self):
     """Test that strings with @@verb are translated
     """
     i18n.install('de_DE')
     expect = 'Version aufnehmen'
     actual = N_('Commit@@verb')
     self.assertEqual(expect, actual)
예제 #17
0
 def test_translates_english_verb(self):
     """Test that English strings with @@verb are properly handled
     """
     i18n.install('en_US.UTF-8')
     expect = 'Commit'
     actual = N_('Commit@@verb')
     self.assertEqual(expect, actual)
예제 #18
0
 def test_guards_against_qstring(self):
     """Test that random QString is passed through as-is
     """
     i18n.install('en_US.UTF-8')
     expect = 'Random'
     actual = i18n.gettext(QtCore.QString('Random'))
     self.assertEqual(expect, actual)
예제 #19
0
 def test_translates_random_english(self):
     """Test that random English strings are passed through as-is
     """
     i18n.install('en_US.UTF-8')
     expect = 'Random'
     actual = N_('Random')
     self.assertEqual(expect, actual)
예제 #20
0
 def test_translates_noun(self):
     """Test that strings with @@noun are translated
     """
     i18n.install('ja_JP')
     expect = uchr(0x30B3) + uchr(0x30DF) + uchr(0x30C3) + uchr(0x30C8)
     actual = N_('Commit@@verb')
     self.assertEqual(expect, actual)
예제 #21
0
 def test_translates_noun(self):
     """Test that strings with @@noun are translated
     """
     i18n.install('ja_JP')
     expect = (unichr(0x30b3) + unichr(0x30df) +
               unichr(0x30c3) + unichr(0x30c8))
     actual = N_('Commit@@verb')
     self.assertEqual(expect, actual)
예제 #22
0
 def test_translates_noun(self):
     """Test that strings with @@noun are translated
     """
     i18n.install('ja_JP')
     expect = (unichr(0x30b3) + unichr(0x30df) + unichr(0x30c3) +
               unichr(0x30c8))
     actual = N_('Commit@@verb')
     self.assertEqual(expect, actual)
예제 #23
0
def test_translate_push_pull_french():
    i18n.install('fr_FR')
    expect = 'Tirer'
    actual = N_('Pull')
    assert expect == actual

    expect = 'Pousser'
    actual = N_('Push')
    assert expect == actual
예제 #24
0
    def test_translate_push_pull_french(self):
        i18n.install('fr_FR')
        expect = 'Tirer'
        actual = N_('Pull')
        self.assertEqual(expect, actual)

        expect = 'Pousser'
        actual = N_('Push')
        self.assertEqual(expect, actual)
예제 #25
0
파일: app.py 프로젝트: runt18/git-cola
    def __init__(self, argv, locale=None, gui=True):
        cfgactions.install()
        i18n.install(locale)
        qtcompat.install()
        qtutils.install()
        icons.install()

        QtCore.QObject.connect(fsmonitor.instance(), SIGNAL('files_changed'),
                               self._update_files)

        if gui:
            self._app = current(tuple(argv))
            self._app.setWindowIcon(icons.cola())
        else:
            self._app = QtCore.QCoreApplication(argv)
예제 #26
0
    def __init__(self, argv, locale=None, gui=True):
        cfgactions.install()
        i18n.install(locale)
        qtcompat.install()
        qtutils.install()
        icons.install()

        QtCore.QObject.connect(fsmonitor.current(), SIGNAL('files_changed'),
                               self._update_files)

        if gui:
            self._app = current(tuple(argv))
            self._app.setWindowIcon(icons.cola())
        else:
            self._app = QtCore.QCoreApplication(argv)
예제 #27
0
파일: app.py 프로젝트: kbielefe/git-cola
    def __init__(self, argv, locale=None, gui=True):
        """Initialize our QApplication for translation
        """
        i18n.install(locale)

        # monkey-patch Qt's translate() to use our translate()
        if gui:
            self._app = instance(tuple(argv))
            self._app.setWindowIcon(QtGui.QIcon(resources.icon('git.svg')))
            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
예제 #28
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)
예제 #29
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)
예제 #30
0
def test_translates_verb():
    """Test that strings with @@verb are translated"""
    i18n.install('de_DE')
    expect = 'Commit aufnehmen'
    actual = N_('Commit@@verb')
    assert expect == actual
예제 #31
0
def test_translates_english_noun():
    """Test that English strings with @@noun are properly handled"""
    i18n.install('en_US.UTF-8')
    expect = 'Commit'
    actual = N_('Commit@@noun')
    assert expect == actual