コード例 #1
0
ファイル: thread.py プロジェクト: gilshwartz/tortoisehg-caja
 def interact_handler(self, wrapper):
     prompt, password, choices, default = wrapper.data
     prompt = hglib.tounicode(prompt)
     if choices:
         dlg = QMessageBox(QMessageBox.Question,
                     _('TortoiseHg Prompt'), prompt, parent=self.parent())
         dlg.setWindowFlags(Qt.Sheet)
         dlg.setWindowModality(Qt.WindowModal)
         for index, choice in enumerate(choices):
             button = dlg.addButton(hglib.tounicode(choice),
                                    QMessageBox.ActionRole)
             button.response = index
             if index == default:
                 dlg.setDefaultButton(button)
         dlg.exec_()
         button = dlg.clickedButton()
         if button is 0:
             self.responseq.put(None)
         else:
             self.responseq.put(button.response)
     else:
         mode = password and QLineEdit.Password \
                          or QLineEdit.Normal
         text, ok = qtlib.getTextInput(self.parent(),
                      _('TortoiseHg Prompt'),
                      prompt.title(),
                      mode=mode)
         if ok:
             text = hglib.fromunicode(text)
         else:
             text = None
         self.responseq.put(text)
コード例 #2
0
ファイル: shelve.py プロジェクト: gilshwartz/tortoisehg-caja
 def newShelf(self, interactive):
     shelve = time.strftime('%Y-%m-%d_%H-%M-%S') + \
              '_parent_rev_%d' % self.repo['.'].rev()
     if interactive:
         name, ok = qtlib.getTextInput(self,
                      _('TortoiseHg New Shelf Name'),
                      _('Specify name of new shelf'),
                      text=shelve)
         if not ok:
             return
         shelve = hglib.fromunicode(name)
         invalids = (':', '#', '/', '\\', '<', '>', '|')
         bads = [c for c in shelve if c in invalids]
         if bads:
             qtlib.ErrorMsgBox(_('Bad filename'),
                               _('A shelf name cannot contain :#/\\<>|'))
             return
     try:
         fn = os.path.join('shelves', shelve)
         shelfpath = self.repo.join(fn)
         if os.path.exists(shelfpath):
             qtlib.ErrorMsgBox(_('File already exists'),
                               _('A shelf file of that name already exists'))
             return
         self.repo.makeshelf(shelve)
         self.showMessage(_('New shelf created'))
         self.refreshCombos()
         if shelfpath in self.shelves:
             self.combob.setCurrentIndex(self.shelves.index(shelfpath))
     except EnvironmentError, e:
         self.showMessage(hglib.tounicode(str(e)))
コード例 #3
0
 def newShelf(self, interactive):
     shelve = time.strftime('%Y-%m-%d_%H-%M-%S') + \
              '_parent_rev_%d' % self.repo['.'].rev()
     if interactive:
         name, ok = qtlib.getTextInput(self,
                                       _('TortoiseHg New Shelf Name'),
                                       _('Specify name of new shelf'),
                                       text=shelve)
         if not ok:
             return
         shelve = hglib.fromunicode(name)
         invalids = (':', '#', '/', '\\', '<', '>', '|')
         bads = [c for c in shelve if c in invalids]
         if bads:
             qtlib.ErrorMsgBox(_('Bad filename'),
                               _('A shelf name cannot contain :#/\\<>|'))
             return
     try:
         fn = os.path.join('shelves', shelve)
         shelfpath = self.repo.join(fn)
         if os.path.exists(shelfpath):
             qtlib.ErrorMsgBox(
                 _('File already exists'),
                 _('A shelf file of that name already exists'))
             return
         self.repo.makeshelf(shelve)
         self.showMessage(_('New shelf created'))
         self.refreshCombos()
         if shelfpath in self.shelves:
             self.combob.setCurrentIndex(self.shelves.index(shelfpath))
     except EnvironmentError, e:
         self.showMessage(hglib.tounicode(str(e)))
コード例 #4
0
ファイル: mq.py プロジェクト: velorientc/git_test7
 def onGuardConfigure(self):
     item = self.queueListWidget.currentItem()
     patch = item._thgpatch
     if item._thgguards:
         uguards = hglib.tounicode(' '.join(item._thgguards))
     else:
         uguards = ''
     new, ok = qtlib.getTextInput(self,
                   _('Configure guards'),
                   _('Input new guards for %s:') % hglib.tounicode(patch),
                   text=uguards)
     if not ok or new == uguards:
         return
     guards = []
     for guard in hglib.fromunicode(new).split(' '):
         guard = guard.strip()
         if not guard:
             continue
         if not (guard[0] == '+' or guard[0] == '-'):
             self.showMessage.emit(_('Guards must begin with "+" or "-"'))
             continue
         guards.append(guard)
     cmdline = ['qguard', '-R', self.repo.root, '--', patch]
     if guards:
         cmdline += guards
     else:
         cmdline.insert(3, '--none')
     if self.cmd.running():
         return
     self.repo.incrementBusyCount()
     self.qtbar.setEnabled(False)
     self.cmd.run(cmdline)
コード例 #5
0
ファイル: thread.py プロジェクト: allenk/tortoisehg-caja
 def interact_handler(self, wrapper):
     prompt, password, choices, default = wrapper.data
     prompt = hglib.tounicode(prompt)
     if choices:
         dlg = QMessageBox(QMessageBox.Question,
                           _('TortoiseHg Prompt'),
                           prompt,
                           parent=self.parent())
         dlg.setWindowFlags(Qt.Sheet)
         dlg.setWindowModality(Qt.WindowModal)
         for index, choice in enumerate(choices):
             button = dlg.addButton(hglib.tounicode(choice),
                                    QMessageBox.ActionRole)
             button.response = index
             if index == default:
                 dlg.setDefaultButton(button)
         dlg.exec_()
         button = dlg.clickedButton()
         if button is 0:
             self.responseq.put(None)
         else:
             self.responseq.put(button.response)
     else:
         mode = password and QLineEdit.Password \
                          or QLineEdit.Normal
         text, ok = qtlib.getTextInput(self.parent(),
                                       _('TortoiseHg Prompt'),
                                       prompt.title(),
                                       mode=mode)
         if ok:
             text = hglib.fromunicode(text)
         else:
             text = None
         self.responseq.put(text)
コード例 #6
0
 def onGuardConfigure(self):
     item = self.queueListWidget.currentItem()
     patch = item._thgpatch
     if item._thgguards:
         uguards = hglib.tounicode(' '.join(item._thgguards))
     else:
         uguards = ''
     new, ok = qtlib.getTextInput(self,
                                  _('Configure guards'),
                                  _('Input new guards for %s:') %
                                  hglib.tounicode(patch),
                                  text=uguards)
     if not ok or new == uguards:
         return
     guards = []
     for guard in hglib.fromunicode(new).split(' '):
         guard = guard.strip()
         if not guard:
             continue
         if not (guard[0] == '+' or guard[0] == '-'):
             self.showMessage.emit(_('Guards must begin with "+" or "-"'))
             continue
         guards.append(guard)
     cmdline = ['qguard', '-R', self.repo.root, '--', patch]
     if guards:
         cmdline += guards
     else:
         cmdline.insert(3, '--none')
     if self.cmd.running():
         return
     self.repo.incrementBusyCount()
     self.qtbar.setEnabled(False)
     self.cmd.run(cmdline)
コード例 #7
0
ファイル: qqueue.py プロジェクト: gilshwartz/tortoisehg-caja
 def qqueueAdd(self):
     title = _('TortoiseHg Prompt')
     # this is the only way I found to make that dialog wide enough :(
     label = _('New patch queue name') + (u' ' * 30)
     qname, ok = qtlib.getTextInput(self, title, label)
     qname = hglib.fromunicode(qname)
     if qname and ok:
         opts = ['--create', qname]
         self.qqueueCommand(opts)
コード例 #8
0
ファイル: qqueue.py プロジェクト: velorientc/git_test7
 def qqueueAdd(self):
     title = _('TortoiseHg Prompt')
     # this is the only way I found to make that dialog wide enough :(
     label = _('New patch queue name') + (u' ' * 30)
     qname, ok = qtlib.getTextInput(self, title, label)
     qname = hglib.fromunicode(qname)
     if qname and ok:
         opts = ['--create', qname]
         self.qqueueCommand(opts)
コード例 #9
0
ファイル: postreview.py プロジェクト: seewindcn/tortoisehg
 def passwordPrompt(self):
     pwd, ok = qtlib.getTextInput(self,
                                  _('Review Board'),
                                  _('Password:'),
                                  mode=QLineEdit.Password)
     if ok and pwd:
         self.password = pwd
         return True
     else:
         self.password = None
         return False
コード例 #10
0
ファイル: postreview.py プロジェクト: allenk/tortoisehg-caja
 def passwordPrompt(self):
     pwd, ok = qtlib.getTextInput(self,
                                  _('Review Board'),
                                  _('Password:'),
                                  mode=QLineEdit.Password)
     if ok and pwd:
         self.password = pwd
         return True
     else:
         self.password = None
         return False
コード例 #11
0
ファイル: mq.py プロジェクト: seewindcn/tortoisehg
 def _onGuardConfigure(self):
     model = self._queueListWidget.model()
     index = self._queueListWidget.currentIndex()
     patch = model.patchName(index)
     uguards = ' '.join(model.patchGuards(index))
     new, ok = qtlib.getTextInput(self,
                   _('Configure guards'),
                   _('Input new guards for %s:') % patch,
                   text=uguards)
     if not ok or new == uguards:
         return
     self._patchActions.guardPatch(patch, unicode(new).split())
コード例 #12
0
ファイル: qqueue.py プロジェクト: gilshwartz/tortoisehg-caja
 def qqueueRename(self):
     uq = self.ql.item(self.ql.currentRow()).text()
     q = hglib.fromunicode(uq)
     if q == 'patches':
         return
     title = _('TortoiseHg Prompt')
     # this is the only way I found to make that dialog wide enough :(
     label = (_("Rename patch queue '%s' to") % uq) + (u' ' * 30)
     newqname, ok = qtlib.getTextInput(self, title, label)
     if newqname:
         newqname = hglib.fromunicode(newqname)
     if newqname and ok:
         opts = ['--rename', newqname]
         self.qqueueCommand(opts)
コード例 #13
0
ファイル: qqueue.py プロジェクト: velorientc/git_test7
 def qqueueRename(self):
     uq = self.ql.item(self.ql.currentRow()).text()
     q = hglib.fromunicode(uq)
     if q == 'patches':
         return
     title = _('TortoiseHg Prompt')
     # this is the only way I found to make that dialog wide enough :(
     label = (_("Rename patch queue '%s' to") % uq) + (u' ' * 30)
     newqname, ok = qtlib.getTextInput(self, title, label)
     if newqname:
         newqname = hglib.fromunicode(newqname)
     if newqname and ok:
         opts = ['--rename', newqname]
         self.qqueueCommand(opts)
コード例 #14
0
ファイル: workbench.py プロジェクト: seewindcn/tortoisehg
 def _gotorev(self):
     rev, ok = qtlib.getTextInput(self,
                                  _("Goto revision"),
                                  _("Enter revision identifier"))
     if ok:
         self.gotorev(rev)