eric6/Plugins/VcsPlugins/vcsMercurial/HgNewProjectOptionsDialog.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 8143
2c730d5fd177
permissions
-rw-r--r--

Updated copyright for 2021.

178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
dd9f0bca5e2f Added plugin for Mercurial version control system.
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) 2010 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2453
diff changeset
7 Module implementing the Mercurial Options Dialog for a new project from the
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2453
diff changeset
8 repository.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10
5548
95b188f96d3d Reworked the Mercurial checkout dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
11 from PyQt5.QtCore import pyqtSlot, QUrl
5554
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
12 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QComboBox
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
4593
cc745fa6c914 Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
14 from E5Gui.E5PathPicker import E5PathPickerModes
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 from .Ui_HgNewProjectOptionsDialog import Ui_HgNewProjectOptionsDialog
5548
95b188f96d3d Reworked the Mercurial checkout dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
17 from .Config import ConfigHgSchemes
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 import Utilities
1939
eadb2328d7d4 Introduced a "workspace" directory that is used as the default for opening or saving new files or projects (configurable on Multiproject config page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
20 import Preferences
5554
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
21 import UI.PixmapCache
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
23
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 class HgNewProjectOptionsDialog(QDialog, Ui_HgNewProjectOptionsDialog):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2453
diff changeset
26 Class implementing the Options Dialog for a new project from the
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2453
diff changeset
27 repository.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
29 def __init__(self, vcs, parent=None):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 Constructor
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 @param vcs reference to the version control object
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 @param parent parent widget (QWidget)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2453
diff changeset
36 super(HgNewProjectOptionsDialog, self).__init__(parent)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.setupUi(self)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38
4593
cc745fa6c914 Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
39 self.vcsProjectDirPicker.setMode(E5PathPickerModes.DirectoryMode)
5554
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
40
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
41 self.__vcs = vcs
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
42
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
43 vcsUrlHistory = self.__vcs.getPlugin().getPreferences(
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
44 "RepositoryUrlHistory")
4593
cc745fa6c914 Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
45 self.vcsUrlPicker.setMode(E5PathPickerModes.DirectoryMode)
5554
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
46 self.vcsUrlPicker.setInsertPolicy(QComboBox.InsertAtTop)
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
47 self.vcsUrlPicker.setSizeAdjustPolicy(
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
48 QComboBox.AdjustToMinimumContentsLength)
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
49 self.vcsUrlPicker.setPathsList(vcsUrlHistory)
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
50 self.vcsUrlClearHistoryButton.setIcon(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
51 UI.PixmapCache.getIcon("editDelete"))
5554
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
52 self.vcsUrlPicker.setText("")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
54 ipath = (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
55 Preferences.getMultiProject("Workspace") or
3334
a75328ebac64 Fixed an issue creating new projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
56 Utilities.getHomeDir()
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
57 )
3334
a75328ebac64 Fixed an issue creating new projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
58 self.__initPaths = [
a75328ebac64 Fixed an issue creating new projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
59 Utilities.fromNativeSeparators(ipath),
a75328ebac64 Fixed an issue creating new projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
60 Utilities.fromNativeSeparators(ipath) + "/",
a75328ebac64 Fixed an issue creating new projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
61 ]
4593
cc745fa6c914 Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
62 self.vcsProjectDirPicker.setText(self.__initPaths[0])
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
63
5554
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
64 self.lfNoteLabel.setVisible(
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
65 self.__vcs.isExtensionActive("largefiles"))
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
66 self.largeCheckBox.setVisible(
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
67 self.__vcs.isExtensionActive("largefiles"))
3334
a75328ebac64 Fixed an issue creating new projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
68
a75328ebac64 Fixed an issue creating new projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
69 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
3366
6084bb3c3911 Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3334
diff changeset
70
6084bb3c3911 Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3334
diff changeset
71 msh = self.minimumSizeHint()
6084bb3c3911 Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3334
diff changeset
72 self.resize(max(self.width(), msh.width()), msh.height())
3334
a75328ebac64 Fixed an issue creating new projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
73
a75328ebac64 Fixed an issue creating new projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
74 @pyqtSlot(str)
4593
cc745fa6c914 Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
75 def on_vcsProjectDirPicker_textChanged(self, txt):
3334
a75328ebac64 Fixed an issue creating new projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
76 """
a75328ebac64 Fixed an issue creating new projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
77 Private slot to handle a change of the project directory.
a75328ebac64 Fixed an issue creating new projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
78
a75328ebac64 Fixed an issue creating new projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
79 @param txt name of the project directory (string)
a75328ebac64 Fixed an issue creating new projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
80 """
a75328ebac64 Fixed an issue creating new projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
81 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(
a75328ebac64 Fixed an issue creating new projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
82 bool(txt) and
a75328ebac64 Fixed an issue creating new projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
83 Utilities.fromNativeSeparators(txt) not in self.__initPaths)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 @pyqtSlot(str)
4593
cc745fa6c914 Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
86 def on_vcsUrlPicker_textChanged(self, txt):
2453
e0b775cb733b Changed logic of the Mercurial options dialog to disallow entering of the protocol in the URL field.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
87 """
e0b775cb733b Changed logic of the Mercurial options dialog to disallow entering of the protocol in the URL field.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
88 Private slot to handle changes of the URL.
e0b775cb733b Changed logic of the Mercurial options dialog to disallow entering of the protocol in the URL field.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
89
e0b775cb733b Changed logic of the Mercurial options dialog to disallow entering of the protocol in the URL field.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
90 @param txt current text of the line edit (string)
e0b775cb733b Changed logic of the Mercurial options dialog to disallow entering of the protocol in the URL field.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
91 """
5548
95b188f96d3d Reworked the Mercurial checkout dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
92 url = QUrl.fromUserInput(txt)
95b188f96d3d Reworked the Mercurial checkout dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
93 enable = url.isValid() and url.scheme() in ConfigHgSchemes
2453
e0b775cb733b Changed logic of the Mercurial options dialog to disallow entering of the protocol in the URL field.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
94 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable)
5548
95b188f96d3d Reworked the Mercurial checkout dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
95
5549
fa21bfab0a29 Little fix for the last change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5548
diff changeset
96 self.vcsUrlPicker.setPickerEnabled(url.scheme() == "file" or
fa21bfab0a29 Little fix for the last change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5548
diff changeset
97 len(txt) == 0)
2453
e0b775cb733b Changed logic of the Mercurial options dialog to disallow entering of the protocol in the URL field.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
98
5554
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
99 @pyqtSlot()
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
100 def on_vcsUrlClearHistoryButton_clicked(self):
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
101 """
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
102 Private slot to clear the history of entered repository URLs.
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
103 """
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
104 currentVcsUrl = self.vcsUrlPicker.text()
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
105 self.vcsUrlPicker.clear()
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
106 self.vcsUrlPicker.setText(currentVcsUrl)
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
107
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
108 self.__saveHistory()
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
109
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 def getData(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 """
5554
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
112 Public slot to retrieve the data entered into the dialog and to
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
113 save the history of entered repository URLs.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 @return a tuple of a string (project directory) and a dictionary
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 containing the data entered.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 """
5554
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
118 self.__saveHistory()
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
119
5548
95b188f96d3d Reworked the Mercurial checkout dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
120 url = QUrl.fromUserInput(self.vcsUrlPicker.text().replace("\\", "/"))
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 vcsdatadict = {
5548
95b188f96d3d Reworked the Mercurial checkout dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
122 "url": url.toString(QUrl.None_),
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
123 "revision": self.vcsRevisionEdit.text(),
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
124 "largefiles": self.largeCheckBox.isChecked(),
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 }
4593
cc745fa6c914 Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
126 return (self.vcsProjectDirPicker.text(), vcsdatadict)
5554
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
127
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
128 def __saveHistory(self):
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
129 """
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
130 Private method to save the repository URL history.
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
131 """
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
132 url = self.vcsUrlPicker.text()
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
133 vcsUrlHistory = self.vcsUrlPicker.getPathItems()
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
134 if url not in vcsUrlHistory:
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
135 vcsUrlHistory.insert(0, url)
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
136
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
137 # max. list sizes is hard coded to 20 entries
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
138 newVcsUrlHistory = [url for url in vcsUrlHistory if url]
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
139 if len(newVcsUrlHistory) > 20:
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
140 newVcsUrlHistory = newVcsUrlHistory[:20]
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
141
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
142 self.__vcs.getPlugin().setPreferences(
c477ae02bf5f Added a repository URL history to the Mercurial plug-in and new project options dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5549
diff changeset
143 "RepositoryUrlHistory", newVcsUrlHistory)

eric ide

mercurial