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; } """)
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)
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)
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)
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; } """)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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
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)
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)
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)
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
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)
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)
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
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