当前位置: 首页>>代码示例>>Python>>正文


Python Translator.Translator类代码示例

本文整理汇总了Python中Translator.Translator的典型用法代码示例。如果您正苦于以下问题:Python Translator类的具体用法?Python Translator怎么用?Python Translator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Translator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Box

class Box(QTabWidget):
    def __init__(self, parent=None):
        QTabWidget.__init__(self, parent)
        self.Parent = parent
        self.tr = Translator("Thrifty")

        self.setMovable(True)
        self.setIconSize(QSize(32, 32))

        self.checkFile = CheckFile(self)
        self.backUp = BackUp(self)
        self.cleanUp = CleanUp(self)
        self.broken = Broken(self)

        self.addTab(self.checkFile, QIcon("/usr/share/thrifty/icons/file.png"), QString(self.tr._translate("File")))
        self.setTabToolTip(0, self.tr._translate("Checks file belonging to a rpmdb"))

        self.addTab(self.backUp, QIcon("/usr/share/thrifty/icons/backup.png"), QString(self.tr._translate("BackUp")))
        self.setTabToolTip(1, self.tr._translate('Back up "rpmdb-out" files <b>(User\Root Mode)</b>.'))

        self.addTab(self.cleanUp, QIcon("/usr/share/thrifty/icons/cleanup.png"), QString(self.tr._translate("CleanUp")))
        self.setTabToolTip(2, self.tr._translate('Clean up "rpmdb-out" files <b>(Root Mode only)</b> or test.'))

        self.addTab(self.broken, QIcon("/usr/share/thrifty/icons/file.png"), QString(self.tr._translate("Broken")))
        self.setTabToolTip(3, self.tr._translate("Search broken packages <b>(Root Mode only)</b>."))

    def setTabsState(self, state):
        self.checkFile.setState(state)
        self.backUp.setState(state)
        self.cleanUp.setState(state)
        self.broken.setState(state)
        self.Parent.stopProcess.setEnabled(not state)
开发者ID:F1ash,项目名称:thrifty-gui,代码行数:32,代码来源:Box.py

示例2: __init__

 def __init__(self, x=0.0, y=0.0, w=0.0, h=0.0):
         Translator.__init__(self)
         Node.__init__(self)
         self.x = x
         self.y = y
         self.w = w
         self.h = h
开发者ID:nbudin,项目名称:solidfuel,代码行数:7,代码来源:Box.py

示例3: __init__

    def __init__(self, filename, compile=True, buffer=None):
        VisibleNode.__init__(self)
        Translator.__init__(self)

        self.rotX = 0.0
        self.rotY = 0.0
        self.rotZ = 0.0

        self.scale = 1.0

        if Model.dlcache.has_key(filename):
            self._displayList = Model.dlcache[filename]
            bb = Model.bbcache[filename]
        else:
            if buffer is None:
                self._dom = dom3ds.read_3ds_file(filename)
            else:
                self._dom = dom3ds.read_3ds_mem(buffer)
            self._model = glmodel.GLModel(self._dom, self._loadTexture)
            bb = self._model.bounding_box()
            Model.bbcache[filename] = bb
            if compile:
                self._displayList = self._model.create_dl()
                Model.dlcache[filename] = self._displayList
            else:
                self._displayList = None
        self._center = (bb[0] + bb[1]) / 2
        self._modelScale = 1.0 / max(abs(bb[0] - bb[1]))
开发者ID:nbudin,项目名称:solidfuel,代码行数:28,代码来源:Model.py

示例4: translate

 def translate(self):
     glPushMatrix()
     Translator.translate(self)
     glTranslate(*-self._center)
     rs = self._rs = self.scale * self._modelScale
     glScale(rs, rs, rs)
     glRotate(self.rotX, 1, 0, 0)
     glRotate(self.rotY, 0, 1, 0)
     glRotate(self.rotZ, 0, 0, 1)
开发者ID:nbudin,项目名称:solidfuel,代码行数:9,代码来源:Model.py

示例5: run

 def run(self):
     '''
     invokes the config parser, generates the sql statements and runs optimizer 
     '''
     Parser=ConfigParser(self.filename)
     config=Parser.configContent
     translator=Translator(config)
     translator.translate()
     self.blocks=translator.getBlocks()
开发者ID:UWQuickstep,项目名称:Grail,代码行数:9,代码来源:Grail.py

示例6: btn_clicked

 def btn_clicked(self, text, cbox, outBox):
     outBox.clear()
     lang = ''
     if cbox.currentIndex() is 0:
         lang = 'eng'
     elif cbox.currentIndex() is 1:
         lang = 'fr'
     trans = Translator(text, lang, self.dict)
     t_text = trans.translate()
     outBox.append(t_text)
开发者ID:kbroten14,项目名称:Picard,代码行数:10,代码来源:View.py

示例7: test_translate_shouldAllowNewlineInReplacement

    def test_translate_shouldAllowNewlineInReplacement(self):
        pattern_replacement = PatternReplacement('set timeout (\d+)',
                                                 r'configure timeout \1\n'
                                                 'enable timeout')
        tlr = Translator(pattern_replacements=[pattern_replacement])
        configline = 'set timeout 10'
        expected = 'configure timeout 10\nenable timeout'

        transl = tlr.translate(configline)

        self.assertEqual(expected, transl.get_xos())
开发者ID:extremenetworks,项目名称:E2X,代码行数:11,代码来源:Translator_test.py

示例8: test_translate_shouldEmitEmptyStringIfNoHintInPatternReplacement

    def test_translate_shouldEmitEmptyStringIfNoHintInPatternReplacement(self):
        pattern = 'show (\d+)'
        configline = 'show 11'
        pattern_replacement = \
            PatternReplacement(pattern, r'show \1')
        tlr = Translator([pattern_replacement])

        transl = tlr.translate(configline)

        self.assertEqual(configline, transl.get_xos())
        self.assertEqual('', transl.get_hint())
开发者ID:extremenetworks,项目名称:E2X,代码行数:11,代码来源:Translator_test.py

示例9: test_translate_shouldEmitHintInPatternReplacement

    def test_translate_shouldEmitHintInPatternReplacement(self):
        pattern = 'show (\d+)'
        hint = 'silly hint'
        configline = 'show 11'
        pattern_replacement_and_hint = \
            PatternReplacement(pattern, r'show \1', 'silly hint')
        tlr = Translator([pattern_replacement_and_hint])

        transl = tlr.translate(configline)

        self.assertEqual(configline, transl.get_xos())
        self.assertEqual(hint, transl.get_hint())
开发者ID:extremenetworks,项目名称:E2X,代码行数:12,代码来源:Translator_test.py

示例10: test_translate_shouldAllowConstantsInPatternString

    def test_translate_shouldAllowConstantsInPatternString(self):
        PATTERN_IPV4 = Translator.PATTERN_IPV4
        pattern = 'ip address (' + PATTERN_IPV4 + ') ' \
                                                  'mask (' + PATTERN_IPV4 + ')'
        pattern_replacement = PatternReplacement(pattern,
                                                 r'\1 \2')
        pattern_replacements = [pattern_replacement]
        tlr = Translator(pattern_replacements)
        configline = 'ip address 1.2.3.4 mask 255.255.255.0'
        expected = '1.2.3.4 255.255.255.0'

        transl = tlr.translate(configline)

        self.assertEqual(expected, transl.get_xos())
开发者ID:extremenetworks,项目名称:E2X,代码行数:14,代码来源:Translator_test.py

示例11: __init__

	def __init__(self, data = {}, parent = None):
		QTabWidget.__init__(self, parent)
		self.Parent = parent
		self.tr = Translator('mailViewer')
		self.mails = []
		self.webViewWDGs = []
		self.iconDatabasePath = os.path.join('/tmp', randomString(24))
		os.mkdir(self.iconDatabasePath)
		self.Settings = Settings

		self.setMovable(True)
		self.setIconSize(QSize(SIZE, SIZE))

		if 'ids' in data and len(data['ids']) :
			i = 0
			for idx in data['ids'] :
				self.mails.append(Mail(idx, self))

				self.addTab(self.mails[i], QIcon().fromTheme("mail"), QString(self.tr._translate('Mail') + ' ' + idx))
				self.setTabToolTip(i, self.tr._translate('Mail') + ' #' + idx)
				i += 1
			self.Parent.statusBar.showMessage(self.tr._translate('Getting mail...'))
			self.mailAttr.connect(self.setMailAttr)
			self.mailData.connect(self.setMailData)
			self.getMail = GetMail(data, self)
			self.startGetMail()
		else :
			self.Parent.statusBar.showMessage(self.tr._translate('Empty Job.'))
开发者ID:prmsh99,项目名称:sample_app,代码行数:28,代码来源:Box.py

示例12: __init__

	def __init__(self, parent = None):
		QWidget.__init__(self, parent)
		self.Parent = parent
		self.tr = Translator('Thrifty')
		self.runned = False
		self.pathToLog = None

		self.layout = QGridLayout()
		self.layout.setAlignment(Qt.AlignCenter)

		self.dirList = QListWidget()
		#self.dirList.setMaximumHeight(150)
		self.dirList.setToolTip(self.tr._translate('A list of directories processed'))

		self.buttonLayout = QVBoxLayout()
		self.buttonLayout.setAlignment(Qt.AlignCenter)
		self.addPath = QPushButton(QIcon('/usr/share/thrifty/icons/plus.png'), '')
		self.addPath.setIconSize(QSize(32,32))
		self.delPath = QPushButton(QIcon('/usr/share/thrifty/icons/delete.png'), '')
		self.delPath.setIconSize(QSize(32,32))
		self.showTargets = QPushButton(QIcon('/usr/share/thrifty/icons/show.png'), '')
		self.showTargets.setIconSize(QSize(32,32))
		self.mode = QComboBox()
		self.mode.setIconSize(QSize(32,32))
		self.mode.setToolTip(self.tr._translate('Packages'))
		self.mode.addItem (QIcon('/usr/share/thrifty/icons/packages.png'), '')
		self.mode.addItem (QIcon('/usr/share/thrifty/icons/files.png'), '')
		self.start = QPushButton(QIcon('/usr/share/thrifty/icons/start.png'), '')
		self.start.setIconSize(QSize(32,32))
		self.addPath.setToolTip(self.tr._translate('Add to List'))
		self.delPath.setToolTip(self.tr._translate('Delete from List'))
		self.showTargets.setToolTip(self.tr._translate('show Targets file'))
		self.start.setToolTip(self.tr._translate('Start task'))
		self.addPath.clicked.connect(self.addDirPath)
		self.delPath.clicked.connect(self.delDirPath)
		self.showTargets.clicked.connect(self.showTargetsList)
		self.start.clicked.connect(self.runSearchBroken)

		self.buttonLayout.addWidget(self.addPath)
		self.buttonLayout.addWidget(self.delPath)
		self.buttonLayout.addWidget(self.start)
		self.buttonLayout.addWidget(self.mode)
		self.buttonLayout.addWidget(self.showTargets)

		self.progress = QProgressBar()
		self.progress.setOrientation(Qt.Vertical)
		self.progress.hide()
		self.progress.setRange(0, 0)

		self.logIn = QLabel('')
		self.logIn.setToolTip(self.tr._translate('Log of processed task'))
		self.logIn.setOpenExternalLinks(True)

		self.layout.addWidget(self.dirList, 0, 0)
		self.layout.addItem(self.buttonLayout, 0, 1)
		self.layout.addWidget(self.progress, 0, 2)
		self.layout.addWidget(self.logIn, 1, 0)

		self.setLayout(self.layout)
		self.mode.currentIndexChanged.connect(self.changeModeContent)
开发者ID:F1ash,项目名称:thrifty-gui,代码行数:60,代码来源:BrokenSearch.py

示例13: __init__

    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.Parent = parent
        self.runned = False
        self.otherDataList = [""]
        self.tr = Translator("Thrifty")
        self.trChunk0 = self.tr._translate("<pre>WARNING: not unique data in rpmDB (")
        self.trChunk1 = self.tr._translate(" records)")

        self.layout = QGridLayout()

        self.pathLayout = QHBoxLayout()

        self.pathString = QLineEdit("")
        self.pathString.returnPressed.connect(self.checkFile)
        self.searchPath = QPushButton(QIcon("/usr/share/thrifty/icons/file.png"), "")
        self.searchPath.setIconSize(QSize(32, 32))
        self.searchPath.setToolTip(self.tr._translate("Path to file"))
        self.searchPath.clicked.connect(self.addPath)

        self.pathLayout.addWidget(self.pathString)
        self.pathLayout.addWidget(self.searchPath)

        self.layout.addItem(self.pathLayout, 0, 0, 2, 3)

        self.package = QLabel(self.tr._translate("Package :"))

        self.mode = QComboBox()
        self.mode.setIconSize(QSize(32, 32))
        self.mode.addItem(QIcon("/usr/share/thrifty/icons/user.png"), "")
        self.mode.addItem(QIcon("/usr/share/thrifty/icons/admin.png"), "")
        self.mode.setToolTip(self.tr._translate("User Mode"))
        self.start = QPushButton(QIcon("/usr/share/thrifty/icons/start.png"), "")
        self.start.setIconSize(QSize(32, 32))
        self.start.clicked.connect(self.checkFile)
        self.start.setToolTip(self.tr._translate("Start task"))

        self.packageCheckSumm = QLabel(self.tr._translate("Package CheckSumm :"))
        self.checkSumm = QLabel(self.tr._translate("Real CheckSumm :"))
        self.packageRes = QComboBox()
        self.packageRes.setSizeAdjustPolicy(QComboBox.AdjustToContents)
        self.packageCheckSummRes = QLabel("")
        self.checkSummRes = QLabel("")
        self.otherData = QLabel("")
        self.layout.addWidget(self.package, 3, 0)
        self.layout.addWidget(self.mode, 4, 0, Qt.AlignLeft)
        self.layout.addWidget(self.start, 4, 0, Qt.AlignRight)
        self.layout.addWidget(self.packageCheckSumm, 5, 0)
        self.layout.addWidget(self.checkSumm, 6, 0)
        self.layout.addWidget(self.packageRes, 3, 1)
        self.layout.addWidget(self.otherData, 4, 1)
        self.layout.addWidget(self.packageCheckSummRes, 5, 1)
        self.layout.addWidget(self.checkSummRes, 6, 1)

        self.setLayout(self.layout)
        self.mode.currentIndexChanged.connect(self.changeMode)
        self.packageRes.currentIndexChanged.connect(self.changePackageContent)
        self.setMinimumSize(32, 32)
开发者ID:F1ash,项目名称:thrifty-gui,代码行数:58,代码来源:CheckFile.py

示例14: test

def test():
    import os
    opts = DefaultOptions()
    opts.logger = Logger()
    opts.logger.start_debug()
    opts.sourceFile = os.path.abspath("./testdata/test.gdb/TRAILS_ln")
    opts.outputFile = "./testdata/test_trails.osm"
    opts.translator = Translator.get_translator("trails")
    opts.datasetKey = get_pk_name(opts, 'nps:source_system_key_value')
    makeosmfile(opts)
开发者ID:nationalparkservice,项目名称:arc2places,代码行数:10,代码来源:arc2osmcore.py

示例15: __init__

	def __init__(self, obj = None, parent= None):
		QWidget.__init__(self, parent)

		self.Parent = obj
		self.prnt = parent
		self.tr = Translator('Filters')
		dir_ = os.path.expanduser('~/.config/plasmaMailChecker')

		self.filterFROM = os.path.join(dir_, 'filter.from')
		self.filterSUBJ = os.path.join(dir_, 'filter.subj')
		i = 0
		for path in (self.filterFROM, self.filterSUBJ) :
			if not os.path.isfile(path) :
				name = self.filterSUBJ if i else self.filterFROM
				with open(name, 'wb') as f : pass
				#print path, 'not exist'
			i += 1

		self.listFROM = dataToList(self.filterFROM)
		self.listSUBJ = dataToList(self.filterSUBJ)

		self.layout = QGridLayout()
		self.layout.setSpacing(0)

		self.labelFROM = QLabel(self.tr._translate("FROM field"))
		self.labelSUBJ = QLabel(self.tr._translate("SUBJ field"))
		self.layout.addWidget(self.labelFROM, 0, 1,  Qt.AlignHCenter)
		self.layout.addWidget(self.labelSUBJ, 0, 2,  Qt.AlignHCenter)

		self.fromEditor = QLineEdit()
		self.subjEditor = QLineEdit()
		self.fromListBox = QListWidget()
		self.fromListBox.setSortingEnabled(True)
		self.fromListBox.setToolTip(self.tr._translate("Filter`s strings"))
		self.fromListBox.addItems(self.listFROM)
		self.fromListBox.currentTextChanged.connect(self.from_FiltersChanged)
		self.subjListBox = QListWidget()
		self.subjListBox.setSortingEnabled(True)
		self.subjListBox.setToolTip(self.tr._translate("Filter`s strings"))
		self.subjListBox.addItems(self.listSUBJ)
		self.subjListBox.currentTextChanged.connect(self.subj_FiltersChanged)

		self.layout.addWidget(self.fromEditor, 1, 1)
		self.layout.addWidget(self.subjEditor, 1, 2)
		self.layout.addWidget(self.fromListBox, 2, 1)
		self.layout.addWidget(self.subjListBox, 2, 2)

		self.buttonFROM = ButtonPanel(0, self)
		self.buttonSUBJ = ButtonPanel(1, self)
		self.layout.addWidget(self.buttonFROM, 2, 0)
		self.layout.addWidget(self.buttonSUBJ, 2, 3)
		self.setLayout(self.layout)
		self.buttonFROM.setCurrentState()
		self.buttonSUBJ.setCurrentState()
		self.StateChanged = [False, False]
开发者ID:prmsh99,项目名称:sample_app,代码行数:55,代码来源:Filter.py


注:本文中的Translator.Translator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。