Mercurial and Git clients can push and pull from this alias URL to interact with this repository. You can change to which repository an alias points by going to the Aliases link on the project page.
# quickop.py - TortoiseHg's dialog for quick dirstate operations## Copyright 2009 Steve Borho <steve@borho.org>## This software may be used and distributed according to the terms of the# GNU General Public License version 2, incorporated herein by reference.importosfrom mercurial import hg, ui, cmdutil, util
-from PyQt4 import QtCore, QtGui
+from PyQt4.QtCore import *+fromPyQt4.QtGui import *from tortoisehg.hgqt.i18n import _
from tortoisehg.util import hglib, shlib, paths
fromtortoisehg.hgqtimportqtlib,status,cmduiLABELS={'add':(_('Checkmark files to add'),_('Add')),'forget':(_('Checkmark files to forget'),_('Forget')), 'revert': (_('Checkmark files to revert'), _('Revert')),
'remove': (_('Checkmark files to remove'), _('Remove')),}
-class QuickOpDialog(QtGui.QDialog):
+class QuickOpDialog(QDialog):
""" Dialog for performing quick dirstate operations """
def __init__(self, command, pats, parent=None):
-QtGui.QDialog.__init__(self, parent)
- self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)
+ QDialog.__init__(self, parent)
+ self.setWindowFlags(self.windowFlags() &
+ ~Qt.WindowContextHelpButtonHint)
self.pats = pats
# Handle rm alias
ifcommand=='rm':command='remove'self.command=commandrepo=hg.repository(ui.ui(),path=paths.find_root())assertrepo os.chdir(repo.root)
self.setWindowTitle('%s - hg %s' % (hglib.get_reponame(repo), command))
- layout = QtGui.QVBoxLayout()
+ layout = QVBoxLayout()
self.setLayout(layout)
- lbl = QtGui.QLabel(LABELS[command][0])
-layout.addWidget(lbl)
+ hbox = QHBoxLayout()+ lbl = QLabel(LABELS[command][0])
+slbl = QLabel()+ hbox.addWidget(lbl)
+ hbox.addStretch(1)+ hbox.addWidget(slbl)+ self.status_label = slbl+ layout.addLayout(hbox) types = { 'add' : 'I?',
'forget' : 'MAR!C',
'revert':'MAR!','remove':'MAR!CI?',}filetypes=types[self.command]opts={}fors,valinstatus.statusTypes.iteritems():opts[val.name]=sinfiletypesstwidget=status.StatusWidget(pats,opts,repo.root,self)layout.addWidget(stwidget,1) if self.command == 'revert':
## no backup checkbox
- chk = QtGui.QCheckBox(_('Do not save backup files (*.orig)'))
+ chk = QCheckBox(_('Do not save backup files (*.orig)'))
self.chk = chk
layout.addWidget(chk)
- BB = QtGui.QDialogButtonBox
- bb = QtGui.QDialogButtonBox(BB.Ok|BB.Cancel)
- self.connect(bb, QtCore.SIGNAL("accepted()"),
- self, QtCore.SLOT("accept()"))
- self.connect(bb, QtCore.SIGNAL("rejected()"),
- self, QtCore.SLOT("reject()"))
+ BB = QDialogButtonBox
+ bb = QDialogButtonBox(BB.Ok|BB.Cancel)
+ self.connect(bb, SIGNAL("accepted()"), self, SLOT("accept()"))
+ self.connect(bb, SIGNAL("rejected()"), self, SLOT("reject()"))
bb.button(BB.Ok).setDefault(True)
bb.button(BB.Ok).setText(LABELS[command][1])
layout.addWidget(bb)
self.bb=bbcmd=cmdui.Widget()cmd.commandStarted.connect(self.commandStarted)cmd.commandFinished.connect(self.commandFinished)cmd.commandCanceling.connect(self.commandCanceled)layout.addWidget(cmd) cmd.setHidden(True)
self.cmd = cmd
- s = QtCore.QSettings()
+ s = QSettings()
stwidget.restoreState(s.value('quickop/state').toByteArray())
self.restoreGeometry(s.value('quickop/geom').toByteArray())
self.stwidget = stwidget
- self.connect(self.stwidget, QtCore.SIGNAL('errorMessage'),
- self.errorMessage)-- def errorMessage(self, msg):- # TODO: Does not appear to work-self.cmd.pmon.set_text(msg)
+ self.connect(self.stwidget, SIGNAL('errorMessage'),
+ self.cmd.pmon.set_text)
def keyPressEvent(self, event):
- if event.key() in (QtCore.Qt.Key_Return, QtCore.Qt.Key_Enter):
- if event.modifiers() == QtCore.Qt.ControlModifier:
+ if event.key() in (Qt.Key_Return, Qt.Key_Enter):
+ if event.modifiers() == Qt.ControlModifier:
self.accept() # Ctrl+Enter
return
- elif event.key() == QtCore.Qt.Key_Escape:
+ elif event.key() == Qt.Key_Escape:
self.reject()
return
- return super(QtGui.QDialog, self).keyPressEvent(event)
+ return super(QDialog, self).keyPressEvent(event)
def commandStarted(self):
self.cmd.setShown(True)
- self.bb.button(QtGui.QDialogButtonBox.Ok).setEnabled(False)
+ self.bb.button(QDialogButtonBox.Ok).setEnabled(False)
def commandFinished(self, wrapper):
- self.bb.button(QtGui.QDialogButtonBox.Ok).setEnabled(True)
+ self.bb.button(QDialogButtonBox.Ok).setEnabled(True)
if wrapper.data is not 0:
self.cmd.show_output(True)
else:
self.reject()
def commandCanceled(self):
- self.bb.button(QtGui.QDialogButtonBox.Ok).setEnabled(True)
+ self.bb.button(QDialogButtonBox.Ok).setEnabled(True)
def accept(self):
cmdline = [self.command]
ifhasattr(self,'chk')andself.chk.isChecked():cmdline.append('--no-backup')files=self.stwidget.getChecked()iffiles:cmdline.extend(files)else:qtlib.WarningMsgBox(_('No files selected'),_('No operation to perform'),parent=self)returnself.cmd.run(cmdline)defreject(self): if self.cmd.core.is_running():
self.cmd.core.cancel()
else:
- s = QtCore.QSettings()
+ s = QSettings()
s.setValue('quickop/state', self.stwidget.saveState())
s.setValue('quickop/geom', self.saveGeometry())
-QtGui.QDialog.reject(self)
+ QDialog.reject(self)
def run(ui, *pats, **opts):
pats = hglib.canonpaths(pats)
ifopts.get('canonpats'):pats=list(pats)+opts['canonpats']returnQuickOpDialog(opts.get('alias'),pats)
Attach a Trello Card
Add a tag
Your session has expired
You are no longer logged in. Please log in and try your request again.
Filter RSS Feed
This RSS feed URL allows you to see the contents of your current filter using any feed reader.
This link includes a special authentication token. If you share the URL with anyone else, they can see this RSS feed's activity. You can disable these tokens when needed.
Your current filter is unsaved; changing it won't affect this RSS feed.