src/eric7/Plugins/VcsPlugins/vcsSubversion/SvnCommandDialog.py

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8881
54e42bc2437a
child 9221
bf71ee032bb4
diff -r 3fc8dfeb6ebe -r b99e7fd55fd3 src/eric7/Plugins/VcsPlugins/vcsSubversion/SvnCommandDialog.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/eric7/Plugins/VcsPlugins/vcsSubversion/SvnCommandDialog.py	Thu Jul 07 11:23:56 2022 +0200
@@ -0,0 +1,79 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2003 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing the Subversion command dialog.
+"""
+
+from PyQt6.QtWidgets import QDialog, QDialogButtonBox
+
+from EricWidgets.EricPathPicker import EricPathPickerModes
+
+from .Ui_SvnCommandDialog import Ui_SvnCommandDialog
+
+import Utilities
+
+
+class SvnCommandDialog(QDialog, Ui_SvnCommandDialog):
+    """
+    Class implementing the Subversion command dialog.
+    
+    It implements a dialog that is used to enter an
+    arbitrary subversion command. It asks the user to enter
+    the commandline parameters and the working directory.
+    """
+    def __init__(self, argvList, wdList, ppath, parent=None):
+        """
+        Constructor
+        
+        @param argvList history list of commandline arguments (list of strings)
+        @param wdList history list of working directories (list of strings)
+        @param ppath pathname of the project directory (string)
+        @param parent parent widget of this dialog (QWidget)
+        """
+        super().__init__(parent)
+        self.setupUi(self)
+        
+        self.workdirPicker.setMode(EricPathPickerModes.DIRECTORY_MODE)
+        
+        self.okButton = self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Ok)
+        self.okButton.setEnabled(False)
+        
+        self.commandCombo.clear()
+        self.commandCombo.addItems(argvList)
+        if len(argvList) > 0:
+            self.commandCombo.setCurrentIndex(0)
+        self.workdirPicker.clear()
+        self.workdirPicker.addItems(wdList)
+        if len(wdList) > 0:
+            self.workdirPicker.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)
+        
+        msh = self.minimumSizeHint()
+        self.resize(max(self.width(), msh.width()), msh.height())
+        
+    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 a tuple of argv, workdir
+        """
+        return (self.commandCombo.currentText(),
+                self.workdirPicker.currentText())

eric ide

mercurial