Plugins/VcsPlugins/vcsMercurial/HgCommandDialog.py

Mon, 12 Apr 2010 18:00:42 +0000

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 12 Apr 2010 18:00:42 +0000
changeset 178
dd9f0bca5e2f
child 189
17bb2db7a347
permissions
-rw-r--r--

Added plugin for Mercurial version control system.

# -*- coding: utf-8 -*-

# Copyright (c) 2010 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing the Mercurial command dialog.
"""

from PyQt4.QtCore import pyqtSlot
from PyQt4.QtGui import QDialog, QDialogButtonBox

from .Ui_HgCommandDialog import Ui_HgCommandDialog

import Utilities

class HgCommandDialog(QDialog, Ui_HgCommandDialog):
    """
    Class implementing the Mercurial command dialog.
    
    It implements a dialog that is used to enter an
    arbitrary Mercurial command. It asks the user to enter
    the commandline parameters.
    """
    def __init__(self, argvList, ppath, parent = None):
        """
        Constructor
        
        @param argvList history list of commandline arguments (list of strings)
        @param ppath pathname of the project directory (string)
        @param parent parent widget of this dialog (QWidget)
        """
        QDialog.__init__(self, parent)
        self.setupUi(self)
        
        self.okButton = self.buttonBox.button(QDialogButtonBox.Ok)
        self.okButton.setEnabled(False)
        
        self.commandCombo.clear()
        self.commandCombo.addItems(argvList)
        if len(argvList) > 0:
            self.commandCombo.setCurrentIndex(0)
        self.projectDirLabel.setText(ppath)
        
        # modify some what's this help texts
        t = self.commandCombo.whatsThis()
        if t:
            t += Utilities.getPercentReplacementHelp()
            self.commandCombo.setWhatsThis(t)
    
    def on_commandCombo_editTextChanged(self, text):
        """
        Private method used to enable/disable the OK-button.
        
        @param text ignored
        """
        self.okButton.setDisabled(self.commandCombo.currentText() == "")
    
    def getData(self):
        """
        Public method to retrieve the data entered into this dialog.
        
        @return commandline parameters (string)
        """
        return self.commandCombo.currentText()

eric ide

mercurial