Thu, 07 Jul 2022 11:23:56 +0200
Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".
1011
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
8881
54e42bc2437a
Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
3 | # Copyright (c) 2011 - 2022 Detlev Offenbach <detlev@die-offenbachs.de> |
1011
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing the bookmark dialog. |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
8318
962bce857696
Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8312
diff
changeset
|
10 | from PyQt6.QtCore import pyqtSlot |
962bce857696
Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8312
diff
changeset
|
11 | from PyQt6.QtWidgets import QDialog, QDialogButtonBox |
1011
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
12 | |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | from .Ui_HgBookmarkDialog import Ui_HgBookmarkDialog |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
14 | |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
15 | |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | class HgBookmarkDialog(QDialog, Ui_HgBookmarkDialog): |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
17 | """ |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | Class mplementing the bookmark dialog. |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | """ |
1017
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
20 | DEFINE_MODE = 0 |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
21 | MOVE_MODE = 1 |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
22 | |
3008
7848489bcb92
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2962
diff
changeset
|
23 | def __init__(self, mode, tagsList, branchesList, bookmarksList, |
7848489bcb92
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2962
diff
changeset
|
24 | parent=None): |
1011
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | """ |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | Constructor |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | |
9025
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
28 | @param mode of the dialog |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
29 | @type int |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
30 | @param tagsList list of tags |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
31 | @type list of str |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
32 | @param branchesList list of branches |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
33 | @type list of str |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
34 | @param bookmarksList list of bookmarks |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
35 | @type list of str |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
36 | @param parent parent widget |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
37 | @type QWidget |
1011
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
38 | """ |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8151
diff
changeset
|
39 | super().__init__(parent) |
1011
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | self.setupUi(self) |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
41 | |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
42 | self.buttonBox.button( |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
43 | QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
1017
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
44 | |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
45 | self.__mode = mode |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
46 | if mode == self.MOVE_MODE: |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
47 | self.nameEdit.hide() |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
48 | self.nameCombo.addItems([""] + sorted(bookmarksList)) |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
49 | self.setWindowTitle(self.tr("Move Bookmark")) |
1017
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
50 | else: |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
51 | self.nameCombo.hide() |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
52 | self.setWindowTitle(self.tr("Define Bookmark")) |
1017
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
53 | |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
54 | self.__bookmarksList = bookmarksList[:] |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
55 | |
1011
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
56 | self.tagCombo.addItems(sorted(tagsList)) |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
57 | self.branchCombo.addItems(["default"] + sorted(branchesList)) |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
58 | self.bookmarkCombo.addItems(sorted(bookmarksList)) |
3366
6084bb3c3911
Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3337
diff
changeset
|
59 | |
9025
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
60 | # connect various radio buttons and input fields |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
61 | self.idButton.toggled.connect(self.__updateOK) |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
62 | self.tagButton.toggled.connect(self.__updateOK) |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
63 | self.branchButton.toggled.connect(self.__updateOK) |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
64 | self.bookmarkButton.toggled.connect(self.__updateOK) |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
65 | self.expressionButton.toggled.connect(self.__updateOK) |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
66 | |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
67 | self.nameCombo.activated.connect(self.__updateOK) |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
68 | self.nameCombo.activated.connect(self.__updateBookmarksCombo) |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
69 | |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
70 | self.nameEdit.textChanged.connect(self.__updateOK) |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
71 | self.idEdit.textChanged.connect(self.__updateOK) |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
72 | self.expressionEdit.textChanged.connect(self.__updateOK) |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
73 | |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
74 | self.tagCombo.editTextChanged.connect(self.__updateOK) |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
75 | self.branchCombo.editTextChanged.connect(self.__updateOK) |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
76 | self.bookmarkCombo.editTextChanged.connect(self.__updateOK) |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
77 | |
3366
6084bb3c3911
Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3337
diff
changeset
|
78 | msh = self.minimumSizeHint() |
6084bb3c3911
Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3337
diff
changeset
|
79 | self.resize(max(self.width(), msh.width()), msh.height()) |
1011
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
80 | |
9025
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
81 | @pyqtSlot() |
1017
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
82 | def __updateOK(self): |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
83 | """ |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
84 | Private slot to update the OK button. |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
85 | """ |
8259
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
86 | enabled = ( |
9025
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
87 | bool(self.nameCombo.currentText()) |
8259
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
88 | if self.__mode == self.MOVE_MODE else |
9025
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
89 | bool(self.nameEdit.text()) |
8259
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
90 | ) |
9025
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
91 | |
1017
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
92 | if self.idButton.isChecked(): |
9025
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
93 | enabled = bool(self.idEdit.text()) |
1017
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
94 | elif self.tagButton.isChecked(): |
9025
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
95 | enabled = bool(self.tagCombo.currentText()) |
1017
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
96 | elif self.branchButton.isChecked(): |
9025
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
97 | enabled = bool(self.branchCombo.currentText()) |
1017
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
98 | elif self.bookmarkButton.isChecked(): |
9025
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
99 | enabled = bool(self.bookmarkCombo.currentText()) |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
100 | elif self.expressionButton.isChecked(): |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
101 | enabled = enabled and bool(self.expressionEdit.text()) |
1017
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
102 | |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
103 | self.buttonBox.button( |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
104 | QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) |
1017
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
105 | |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
106 | def __updateBookmarksCombo(self): |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
107 | """ |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
108 | Private slot to update the bookmarks combo. |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
109 | """ |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
110 | if self.__mode == self.MOVE_MODE: |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
111 | bookmark = self.nameCombo.currentText() |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
112 | selectedBookmark = self.bookmarkCombo.currentText() |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
113 | self.bookmarkCombo.clearEditText() |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
114 | self.bookmarkCombo.clear() |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
115 | self.bookmarkCombo.addItems(sorted(self.__bookmarksList)) |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
116 | index = self.bookmarkCombo.findText(bookmark) |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
117 | if index > -1: |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
118 | self.bookmarkCombo.removeItem(index) |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
119 | if selectedBookmark: |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
120 | index = self.bookmarkCombo.findText(selectedBookmark) |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
121 | if index > -1: |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
122 | self.bookmarkCombo.setCurrentIndex(index) |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
123 | |
1011
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | def getData(self): |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
125 | """ |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
126 | Public method to retrieve the entered data. |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
127 | |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
128 | @return tuple naming the revision and the bookmark name |
9025
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
129 | @rtype tuple of (str, str) |
1011
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
130 | """ |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
131 | if self.numberButton.isChecked(): |
3337
49faa820151a
Corrected some Mercurial input dialogs offering to enter either a revision number or a changeset id to use rev() and id() to make the operation unambigous.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3190
diff
changeset
|
132 | rev = "rev({0})".format(self.numberSpinBox.value()) |
1011
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
133 | elif self.idButton.isChecked(): |
3337
49faa820151a
Corrected some Mercurial input dialogs offering to enter either a revision number or a changeset id to use rev() and id() to make the operation unambigous.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3190
diff
changeset
|
134 | rev = "id({0})".format(self.idEdit.text()) |
1011
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
135 | elif self.tagButton.isChecked(): |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
136 | rev = self.tagCombo.currentText() |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
137 | elif self.branchButton.isChecked(): |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
138 | rev = self.branchCombo.currentText() |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
139 | elif self.bookmarkButton.isChecked(): |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
140 | rev = self.bookmarkCombo.currentText() |
9025
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
141 | elif self.expressionButton.isChecked(): |
9fe8cfa14542
Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
142 | rev = self.expressionEdit.text() |
1011
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
143 | else: |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
144 | rev = "" |
0b118aefae5b
Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
145 | |
8259
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
146 | name = ( |
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
147 | self.nameCombo.currentText().replace(" ", "_") |
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
148 | if self.__mode == self.MOVE_MODE else |
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
149 | self.nameEdit.text().replace(" ", "_") |
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
150 | ) |
1017
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
151 | |
919147f2b518
Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1011
diff
changeset
|
152 | return rev, name |