def test_get_translation(): gettext.set_locale('fr') ret = gettext.get_translation() assert ret is not None ret = gettext.get_translation(package='hackedit-python') assert ret is not None # test with a locale that does not exists gettext.set_locale('martian') gettext.get_translation() gettext.set_locale('fr')
def retranslateUi(self, Form): from hackedit.api.gettext import get_translation _ = get_translation(package="hackedit") Form.setWindowTitle(_("Form")) self.label.setText(_("Compiler flags:")) self.edit_flags.setToolTip( _("<html><head/><body><p>List of extra compiler flags. Each entry in the list must be separated by a white space.</p></body></html>" )) self.label_18.setText(_("Libraries:")) self.edit_libs.setToolTip( _("<html><head/><body><p>The list of libraries you would like your programs to link with (-l option).</p><p>Each entry in the list must be separated by a white space</p></body></html>" )) self.groupBox.setTitle(_("Paths")) self.groupBox_2.setTitle(_("Includes")) self.list_include_paths.setToolTip( _("<html><head/><body><p>The list of include paths</p></body></html>" )) self.bt_abs_include_path.setToolTip(_("Add an absolute library path")) self.bt_abs_include_path.setText(_("...")) self.bt_rel_include_path.setToolTip(_("Add a relative library path")) self.bt_rel_include_path.setText(_("...")) self.bt_delete_include_path.setToolTip(_("Delete selected path")) self.bt_delete_include_path.setText(_("...")) self.groupBox_3.setTitle(_("Libraries")) self.list_lib_paths.setToolTip( _("<html><head/><body><p>The list of library paths.</p></body></html>" )) self.bt_abs_lib_path.setToolTip(_("Add an absolute library path")) self.bt_abs_lib_path.setText(_("...")) self.bt_rel_lib_path.setToolTip(_("Add a relative library path")) self.bt_rel_lib_path.setText(_("...")) self.bt_delete_lib_path.setToolTip(_("Delete selected path")) self.bt_delete_lib_path.setText(_("..."))
def retranslateUi(self, Form): from hackedit.api.gettext import get_translation _ = get_translation(package="hackedit-python") Form.setWindowTitle(_("Form")) self.groupBox.setTitle(_("On open")) self.cb_fold_imports.setToolTip(_("Fold imports statements when opening a python file.")) self.cb_fold_imports.setText(_("Fold imports")) self.cb_fold_docstrings.setToolTip(_("Fold docstring when opening a python file.")) self.cb_fold_docstrings.setText(_("Fold docstrings"))
def retranslateUi(self, Form): from hackedit.api.gettext import get_translation _ = get_translation(package="hackedit") Form.setWindowTitle(_("Form")) self.groupBox_2.setTitle(_("Sources")) self.bt_add_source.setToolTip(_("Add a template source")) self.bt_add_source.setText(_("Add")) self.bt_rm_source.setToolTip(_("Remove template source")) self.bt_rm_source.setText(_("Remove")) self.group_details.setTitle(_("Templates"))
def retranslateUi(self, Dialog): from hackedit.api.gettext import get_translation _ = get_translation(package="hackedit") Dialog.setWindowTitle(_("Template variables")) item = self.tableWidget.verticalHeaderItem(0) item.setText(_("New Row")) item = self.tableWidget.horizontalHeaderItem(0) item.setText(_("Variable")) item = self.tableWidget.horizontalHeaderItem(1) item.setText(_("Value")) __sortingEnabled = self.tableWidget.isSortingEnabled() self.tableWidget.setSortingEnabled(False) self.tableWidget.setSortingEnabled(__sortingEnabled)
def retranslateUi(self, Dialog): from hackedit.api.gettext import get_translation _ = get_translation(package="hackedit-python") Dialog.setWindowTitle(_("Edit breakpoints")) self.groupBox.setTitle(_("Breakpoints")) self.bt_remove_bp.setText(_("...")) self.groupBoxProperties.setTitle(_("Properties")) self.cb_enabled.setText(_("Enabled")) self.label_2.setText(_("Condition:")) self.cb_suspend.setToolTip(_("True to suspend program when the debugger hits the breakpoint. False to continue.")) self.cb_suspend.setText(_("Suspend")) self.cb_log_msg.setText(_("Log message to console")) self.cb_log_exp.setText(_("Log evaluated expression:"))
def retranslateUi(self, Form): from hackedit.api.gettext import get_translation _ = get_translation(package="hackedit-python") Form.setWindowTitle(_("Form")) self.groupBox.setTitle(_("Default interpreter")) self.comboBox.setToolTip(_("Select the default interpreter that will be used when opening new projects.")) self.bt_manage_interpreters.setToolTip(_("Manage python interpreters")) self.bt_manage_interpreters.setText(_("Manage ")) self.groupBox_2.setTitle(_("Packages")) self.tableWidget.setToolTip(_("The list of installed package for the selected interpreter.")) self.tableWidget.setSortingEnabled(True) self.bt_add_packages.setToolTip(_("Install one or more packages")) self.bt_rm_package.setToolTip(_("Uninstall selected package")) self.bt_update_package.setToolTip(_("Update selected package"))
def retranslateUi(self, Dialog): from hackedit.api.gettext import get_translation _ = get_translation(package="hackedit-python") Dialog.setWindowTitle(_("Edit breakpoints")) self.groupBox.setTitle(_("Breakpoints")) self.bt_remove_bp.setText(_("...")) self.groupBoxProperties.setTitle(_("Properties")) self.cb_enabled.setText(_("Enabled")) self.label_2.setText(_("Condition:")) self.cb_suspend.setToolTip( _("True to suspend program when the debugger hits the breakpoint. False to continue." )) self.cb_suspend.setText(_("Suspend")) self.cb_log_msg.setText(_("Log message to console")) self.cb_log_exp.setText(_("Log evaluated expression:"))
def retranslateUi(self, Dialog): from hackedit.api.gettext import get_translation _ = get_translation(package="hackedit-python") Dialog.setWindowTitle(_("Create virtual environment")) self.label.setText(_("Name:")) self.edit_name.setToolTip(_("Name of the virtual environment")) self.label_2.setText(_("Directory:")) self.edit_dir.setToolTip(_("Path where to create the virtual env.")) self.bt_dir.setToolTip(_("Choose directory")) self.bt_dir.setText(_("...")) self.label_4.setText(_("Fullpath:")) self.label_full_path.setToolTip(_("Full path (Directory + Name)")) self.label_full_path.setText(_("path")) self.label_3.setText(_("Base interpreter:")) self.combo_interpreters.setToolTip(_("Choose the base interpreter to use to create the virtual environment.")) self.check_box_site_packages.setToolTip(_("Inherit global site-packages")) self.check_box_site_packages.setText(_("Inherit global site-packages"))
def retranslateUi(self, Form): from hackedit.api.gettext import get_translation _ = get_translation(package="hackedit-python") Form.setWindowTitle(_("Form")) self.groupBox.setTitle(_("Default interpreter")) self.comboBox.setToolTip( _("Select the default interpreter that will be used when opening new projects." )) self.bt_manage_interpreters.setToolTip(_("Manage python interpreters")) self.bt_manage_interpreters.setText(_("Manage ")) self.groupBox_2.setTitle(_("Packages")) self.tableWidget.setToolTip( _("The list of installed package for the selected interpreter.")) self.tableWidget.setSortingEnabled(True) self.bt_add_packages.setToolTip(_("Install one or more packages")) self.bt_rm_package.setToolTip(_("Uninstall selected package")) self.bt_update_package.setToolTip(_("Update selected package"))
def retranslateUi(self, Form): from hackedit.api.gettext import get_translation _ = get_translation(package="hackedit") Form.setWindowTitle(_("Form")) self.table_packages.setToolTip( _("The list of installed package for the selected interpreter.")) self.table_packages.setSortingEnabled(True) item = self.table_packages.horizontalHeaderItem(0) item.setText(_("Name")) item = self.table_packages.horizontalHeaderItem(1) item.setText(_("Version")) item = self.table_packages.horizontalHeaderItem(2) item.setText(_("Latest")) self.label_status.setText(_("Updating package list")) self.bt_add_packages.setToolTip(_("Install one or more packages")) self.bt_rm_package.setToolTip(_("Uninstall selected package")) self.bt_update_package.setToolTip(_("Update selected package"))
def retranslateUi(self, Dialog): from hackedit.api.gettext import get_translation _ = get_translation(package="hackedit-python") Dialog.setWindowTitle(_("Create virtual environment")) self.label.setText(_("Name:")) self.edit_name.setToolTip(_("Name of the virtual environment")) self.label_2.setText(_("Directory:")) self.edit_dir.setToolTip(_("Path where to create the virtual env.")) self.bt_dir.setToolTip(_("Choose directory")) self.bt_dir.setText(_("...")) self.label_4.setText(_("Fullpath:")) self.label_full_path.setToolTip(_("Full path (Directory + Name)")) self.label_full_path.setText(_("path")) self.label_3.setText(_("Base interpreter:")) self.combo_interpreters.setToolTip( _("Choose the base interpreter to use to create the virtual environment." )) self.check_box_site_packages.setToolTip( _("Inherit global site-packages")) self.check_box_site_packages.setText(_("Inherit global site-packages"))
def retranslateUi(self, Dialog): from hackedit.api.gettext import get_translation _ = get_translation(package="hackedit") Dialog.setWindowTitle(_("Dialog")) self.console.setToolTip(_("Process output")) self.buttonBox.setToolTip(_("Cancel operation"))
os.environ['PYTEST_QT_API'] = 'pyqt5' os.environ['QT_API'] = 'pyqt5' os.environ['HACKEDIT_CORE_TEST_SUITE'] = '1' os.environ['HACKEDIT_VENDOR_PATH'] = 'hackedit/vendor' sys.path.insert(0, os.environ['HACKEDIT_VENDOR_PATH']) from hackedit.main import setup_sqlite3 # noqa setup_sqlite3() app = QtWidgets.QApplication(sys.argv) QtWidgets.qApp.setOrganizationName('HackEdit-TestSuite') QtWidgets.qApp.setApplicationDisplayName('HackEdit-TestSuite') QtWidgets.qApp.setApplicationName('HackEdit-TestSuite') from hackedit.api.gettext import get_translation # noqa get_translation() for pth in [ 'tests/data/FooBarProj/.hackedit', 'tests/data/SpamEggsProj/.hackedit', 'tests/data/SpamEggsProj2/.hackedit', 'tests/data/SpamEggsProj3/.hackedit' ]: try: shutil.rmtree(os.path.join(os.getcwd(), pth)) except OSError: pass import logging from hackedit.app import logger logger.setup(logging.INFO)
def retranslateUi(self, Dialog): from hackedit.api.gettext import get_translation _ = get_translation(package="hackedit") Dialog.setWindowTitle(_("Check compiler"))
os.environ['HACKEDIT_CORE_TEST_SUITE'] = '1' os.environ['HACKEDIT_VENDOR_PATH'] = 'hackedit/vendor' sys.path.insert(0, os.environ['HACKEDIT_VENDOR_PATH']) from hackedit.main import setup_sqlite3 # noqa setup_sqlite3() app = QtWidgets.QApplication(sys.argv) QtWidgets.qApp.setOrganizationName('HackEdit-TestSuite') QtWidgets.qApp.setApplicationDisplayName('HackEdit-TestSuite') QtWidgets.qApp.setApplicationName('HackEdit-TestSuite') from hackedit.api.gettext import get_translation # noqa get_translation() for pth in ['tests/data/FooBarProj/.hackedit', 'tests/data/SpamEggsProj/.hackedit', 'tests/data/SpamEggsProj2/.hackedit', 'tests/data/SpamEggsProj3/.hackedit']: try: shutil.rmtree(os.path.join(os.getcwd(), pth)) except OSError: pass import logging from hackedit.app import logger logger.setup(logging.INFO)
def retranslateUi(self, Dialog): from hackedit.api.gettext import get_translation _ = get_translation(package="hackedit-python") Dialog.setWindowTitle(_("Dialog")) self.label.setText(_("Rename %s and its usages to: "))
def main(): """ Application entry point, runs the application """ # parse command line args args = argparser.parse_args() if args.log: # print the last application log try: with open(logger.get_path(), 'r') as f: print(f.read()) finally: sys.exit(0) if args.version: # print versions from hackedit.api.versions import versions_str print(versions_str()) sys.exit(0) # tell pyqode that we use the PyQt5 API. os.environ['QT_API'] = 'pyqt5' # Setup Qt Application qapp = QtWidgets.QApplication(sys.argv) qapp.setOrganizationName('HackEdit') qapp.setOrganizationDomain('hackedit.com') qapp.setApplicationDisplayName('HackEdit') qapp.setApplicationName('HackEdit') qapp.setApplicationVersion(__version__) get_translation() # setup logger from hackedit.app import settings settings.load() log_level = settings.log_level() # override log level if args.log_level: log_level = args.log_level elif args.verbose: log_level = logging.DEBUG logger.setup(log_level) _logger().info('hackedit vendor path: %s', os.environ.get('HACKEDIT_VENDOR_PATH')) # Setup splash screen if settings.show_splashscreen(): from hackedit.app.forms import hackedit_rc assert hackedit_rc pixmap = QtGui.QPixmap(':/splashscreen.png') splash = QtWidgets.QSplashScreen(pixmap) splash.show() splash.raise_() qapp.processEvents() splash.showMessage(_('Loading application module'), QtCore.Qt.AlignBottom | QtCore.Qt.AlignHCenter, QtCore.Qt.white) qapp.processEvents() else: splash = None # Setup hackedit application, this may take a while as we have # to load all plugin entry points, load the icon theme,... from hackedit.app.application import Application app = Application(qapp, splash, args) # Run the application! _logger().info('running...') app.run() # remove temporary stdout/stderr try: sys.stdout.close() os.remove(stdout_path) except OSError: pass try: sys.stderr.close() os.remove(stderr_path) except OSError: pass
def main(): """ Application entry point, runs the application """ # parse command line args args = argparser.parse_args() if args.log: # print the last application log try: with open(logger.get_path(), 'r') as f: print(f.read()) finally: sys.exit(0) if args.version: # print versions from hackedit.api.versions import versions_str print(versions_str()) sys.exit(0) # tell pyqode that we use the PyQt5 API. os.environ['QT_API'] = 'pyqt5' # Setup Qt Application qapp = QtWidgets.QApplication(sys.argv) qapp.setOrganizationName('HackEdit') qapp.setOrganizationDomain('hackedit.com') qapp.setApplicationDisplayName('HackEdit') qapp.setApplicationName('HackEdit') qapp.setApplicationVersion(__version__) get_translation() # setup logger from hackedit.app import settings settings.load() log_level = settings.log_level() # override log level if args.log_level: log_level = args.log_level elif args.verbose: log_level = logging.DEBUG logger.setup(log_level) _logger().info('starting up...') # Setup splash screen if settings.show_splashscreen(): from hackedit.app.forms import hackedit_rc assert hackedit_rc pixmap = QtGui.QPixmap(':/splashscreen.png') splash = QtWidgets.QSplashScreen(pixmap) splash.show() splash.raise_() qapp.processEvents() splash.showMessage(_('Loading application module'), QtCore.Qt.AlignBottom | QtCore.Qt.AlignHCenter, QtCore.Qt.white) qapp.processEvents() else: splash = None # Setup hackedit application, this may take a while as we have # to load all plugin entry points, load the icon theme,... from hackedit.app.application import Application app = Application(qapp, splash, args) # Run the application! _logger().info('running...') app.run() # remove temporary stdout/stderr try: sys.stdout.close() os.remove(stdout_path) except OSError: pass try: sys.stderr.close() os.remove(stderr_path) except OSError: pass
def retranslateUi(self, Form): from hackedit.api.gettext import get_translation _ = get_translation(package="hackedit") Form.setWindowTitle(_("Form")) self.tree_interpreters.headerItem().setText(0, _("Name")) self.tree_interpreters.headerItem().setText(1, _("Type")) self.tree_interpreters.headerItem().setText(2, _("Version")) self.tree_interpreters.headerItem().setText(3, _("Default")) __sortingEnabled = self.tree_interpreters.isSortingEnabled() self.tree_interpreters.setSortingEnabled(False) self.tree_interpreters.topLevelItem(0).setText(0, _("Auto-detected")) self.tree_interpreters.topLevelItem(1).setText(0, _("Manual")) self.tree_interpreters.setSortingEnabled(__sortingEnabled) self.label_4.setText(_("Interpreter:")) self.edit_interpreter.setToolTip(_("Interpreter path or command")) self.bt_select_interpreter.setToolTip(_("Select interpreter")) self.bt_select_interpreter.setText(_("...")) self.groupBox_2.setTitle(_("Environment")) self.table_interpreter_env_vars.setToolTip( _("<html><head/><body><p>The list of environment variables to set for running a script.</p><p>Note that the values defined in this list erase any previous value you might have defined in your system (except for empty values and for the PATH environment variable which get prepended to the existing path).</p><p><br/></p></body></html>" )) item = self.table_interpreter_env_vars.horizontalHeaderItem(0) item.setText(_("Key")) item = self.table_interpreter_env_vars.horizontalHeaderItem(1) item.setText(_("Value")) self.bt_add_interpreter_env_var.setToolTip( _("Add an environment variable")) self.bt_rm_interpreter_env_var.setToolTip( _("Remove the selected environment variable.")) self.tab_widget_interpreter_settings.setTabText( self.tab_widget_interpreter_settings.indexOf( self.tab_interpreter_setup), _("Setup")) self.tab_widget_interpreter_settings.setTabText( self.tab_widget_interpreter_settings.indexOf(self.tab_packages), _("Packages")) self.bt_add_interpreter.setToolTip(_("Add a new interpreter")) self.bt_add_interpreter.setText(_("Add")) self.bt_clone_interpreter.setToolTip( _("Clone the selected interpreter")) self.bt_clone_interpreter.setText(_("Clone")) self.bt_delete_interpreter.setToolTip( _("Delete the selected interpreter")) self.bt_delete_interpreter.setText(_("Delete")) self.bt_make_default_interpreter.setToolTip( _("Make the selected interpreter the default for its type.")) self.bt_make_default_interpreter.setText(_("Make default")) self.bt_check_interpreter.setToolTip( _("Check if the selected interpreter works")) self.bt_check_interpreter.setText(_("Check")) self.tab_categories.setTabText( self.tab_categories.indexOf(self.tab_interpreters), _("Interpreters")) self.tree_compilers.headerItem().setText(0, _("Name")) self.tree_compilers.headerItem().setText(1, _("Type")) self.tree_compilers.headerItem().setText(2, _("Version")) self.tree_compilers.headerItem().setText(3, _("Default")) __sortingEnabled = self.tree_compilers.isSortingEnabled() self.tree_compilers.setSortingEnabled(False) self.tree_compilers.topLevelItem(0).setText(0, _("Auto-detected")) self.tree_compilers.topLevelItem(1).setText(0, _("Manual")) self.tree_compilers.setSortingEnabled(__sortingEnabled) self.label_2.setText(_("Compiler:")) self.edit_compiler.setToolTip(_("Compiler path or command")) self.bt_select_compiler.setToolTip(_("Select compiler")) self.bt_select_compiler.setText(_("...")) self.group_msvc.setToolTip( _("Check this if you\'re using a MSVC based compiler.")) self.group_msvc.setTitle(_("MSVC S&upport")) self.label_vcvarsall.setText(_("VCVARSALL:")) self.edit_vcvarsall.setToolTip( _("Path to vcvarsall needed to setup a MSVC based compiler.")) self.bt_select_vcvarsall.setToolTip( _("Select vcvarsall.bat if the compiler is a MSVC based compiler.") ) self.bt_select_vcvarsall.setText(_("...")) self.label.setText(_("Architecture:")) self.combo_vcvarsall_arch.setToolTip( _("The MSVC architecture: 32 bits or 64 bits")) self.combo_vcvarsall_arch.setItemText(0, _("x86")) self.combo_vcvarsall_arch.setItemText(1, _("x64")) self.groupBox.setTitle(_("Environment")) self.table_env_vars.setToolTip( _("<html><head/><body><p>The list of environment variables to set fore compiling a file.</p><p>Note that the values defined in this list erase any previous value you might have defined in your system (except for empty values and for the PATH environment variable which get prepended to the existing PATH).</p><p><br/></p></body></html>" )) item = self.table_env_vars.horizontalHeaderItem(0) item.setText(_("Key")) item = self.table_env_vars.horizontalHeaderItem(1) item.setText(_("Value")) self.bt_add_env_var.setToolTip( _("Add an environment variable to set on the compiler process.")) self.bt_rm_env_var.setToolTip( _("Remove the selected environment variable.")) self.tab_compiler_settings.setTabText( self.tab_compiler_settings.indexOf(self.tab_compiler_setup), _("Setup")) self.tab_compiler_settings.setTabText( self.tab_compiler_settings.indexOf(self.tab_default_options), _("Default options")) self.bt_add_compiler.setToolTip( _("<html><head/><body><p>Add a new compiler</p></body></html>")) self.bt_add_compiler.setText(_("Add")) self.bt_clone_compiler.setToolTip(_("Clone the selected compiler")) self.bt_clone_compiler.setText(_("Clone")) self.bt_delete_compiler.setToolTip(_("Delete the selected compiler")) self.bt_delete_compiler.setText(_("Delete")) self.bt_make_default_compiler.setToolTip( _("Make the selected compiler the default for its type")) self.bt_make_default_compiler.setText(_("Make default")) self.bt_check_compiler.setToolTip( _("Check if the selected compiler works")) self.bt_check_compiler.setText(_("Check")) self.tab_categories.setTabText( self.tab_categories.indexOf(self.tab_compilers), _("Compilers")) self.tab_categories.setTabToolTip( self.tab_categories.indexOf(self.tab_compilers), _("This tab lets you configure compilers used by the hackedit build system." )) self.tree_pre_compilers.headerItem().setText(0, _("Name")) self.tree_pre_compilers.headerItem().setText(1, _("Type")) self.tree_pre_compilers.headerItem().setText(2, _("Version")) self.tree_pre_compilers.headerItem().setText(3, _("Default")) __sortingEnabled = self.tree_pre_compilers.isSortingEnabled() self.tree_pre_compilers.setSortingEnabled(False) self.tree_pre_compilers.topLevelItem(0).setText(0, _("Auto-detected")) self.tree_pre_compilers.topLevelItem(1).setText(0, _("Manual")) self.tree_pre_compilers.setSortingEnabled(__sortingEnabled) self.group_pre_compiler_settings.setTitle(_("Settings")) self.label_3.setText(_("Pre-compiler:")) self.edit_pre_compiler_path.setToolTip(_("Path of the pre-compiler")) self.bt_select_pre_compiler_path.setToolTip(_("Select pre-compiler")) self.bt_select_pre_compiler_path.setText(_("...")) self.label_5.setText(_("Flags:")) self.edit_pre_compiler_flags.setToolTip(_("Pre-compiler flags")) self.label_7.setText(_("Output pattern:")) self.edit_pre_compiler_output_pattern.setToolTip( _("Output pattern (e.g. $input_file_name.cob)")) self.bt_add_pre_compiler.setToolTip(_("Add a new pre-compiler")) self.bt_add_pre_compiler.setText(_("Add")) self.bt_clone_pre_compiler.setToolTip( _("Clone the selected pre-compiler")) self.bt_clone_pre_compiler.setText(_("Clone")) self.bt_delete_pre_compiler.setToolTip( _("Delete the selected pre-compiler")) self.bt_delete_pre_compiler.setText(_("Delete")) self.bt_make_default_pre_compiler.setToolTip( _("Make the selected pre-compiler the default for its type.")) self.bt_make_default_pre_compiler.setText(_("Make default")) self.bt_check_pre_compiler.setToolTip( _("Check if the selected pre-compiler works")) self.bt_check_pre_compiler.setText(_("Check")) self.tab_categories.setTabText( self.tab_categories.indexOf(self.tab_pre_compilers), _("Pre-compilers")) self.tab_categories.setTabToolTip( self.tab_categories.indexOf(self.tab_pre_compilers), _("<html><head/><body><p>This tab let your configure pre-compilers or transpilers used by the hackedit\'s build system</p><p><br/></p><p>Pre-compilers are tools that process a source file into another source file (e.g. sass, flex, bison or any tools that let you extend a language with custom syntax).</p><p><br/></p><p>The pre-compiler pass will alaways occur before the compiler pass.</p></body></html>" ))
def retranslateUi(self, Dialog): from hackedit.api.gettext import get_translation _ = get_translation(package="hackedit") Dialog.setWindowTitle(_("Dialog")) self.label.setText(_("Message"))