eric6/Plugins/VcsPlugins/vcsMercurial/ShelveExtension/HgUnshelveDataDialog.py

Wed, 30 Dec 2020 11:00:44 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 30 Dec 2020 11:00:44 +0100
branch
maintenance
changeset 7924
8a96736d465e
parent 7780
41420f82c0ac
child 8218
7c09585bd960
permissions
-rw-r--r--

Updated copyright for 2021.

3297
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7924
8a96736d465e Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
3 # Copyright (c) 2014 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
3297
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to enter the data for an unshelve operation.
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
10 from PyQt5.QtWidgets import QDialog
3297
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from .Ui_HgUnshelveDataDialog import Ui_HgUnshelveDataDialog
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 class HgUnshelveDataDialog(QDialog, Ui_HgUnshelveDataDialog):
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 """
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 Class implementing a dialog to enter the data for an unshelve operation.
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 """
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 def __init__(self, shelveNames, shelveName="", parent=None):
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 """
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 Constructor
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 @param shelveNames list of available shelves (list of string)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 @param shelveName name of the shelve to restore (string)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 @param parent reference to the parent widget (QWidget)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 """
3484
645c12de6b0c Merge with default branch.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3408
diff changeset
27 super(HgUnshelveDataDialog, self).__init__(parent)
3297
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 self.setupUi(self)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 self.nameComboBox.addItem("")
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 self.nameComboBox.addItems(sorted(shelveNames))
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 if shelveName and shelveName in shelveNames:
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 self.nameComboBox.setCurrentIndex(
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 self.nameComboBox.findText(shelveName))
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36
3366
6084bb3c3911 Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3297
diff changeset
37 msh = self.minimumSizeHint()
6084bb3c3911 Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3297
diff changeset
38 self.resize(max(self.width(), msh.width()), msh.height())
3297
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 def getData(self):
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 """
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 Public method to get the user data.
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 @return tuple containing the name (string) and a flag indicating
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 to keep the shelved change (boolean)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 """
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 return (
3408
b6e6a7062d12 Changed some Mercurial dialogs asking for a (tag, branch,...) name to convert spaces to underscores because spaces are not really recommended.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3366
diff changeset
48 self.nameComboBox.currentText().replace(" ", "_"),
3297
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 self.keepCheckBox.isChecked()
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 )

eric ide

mercurial