|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2002 - 2021 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the VCS command options dialog. |
|
8 """ |
|
9 |
|
10 from PyQt5.QtWidgets import QDialog |
|
11 |
|
12 from .Ui_CommandOptionsDialog import Ui_VcsCommandOptionsDialog |
|
13 |
|
14 import Utilities |
|
15 |
|
16 |
|
17 class VcsCommandOptionsDialog(QDialog, Ui_VcsCommandOptionsDialog): |
|
18 """ |
|
19 Class implementing the VCS command options dialog. |
|
20 """ |
|
21 def __init__(self, vcs, parent=None): |
|
22 """ |
|
23 Constructor |
|
24 |
|
25 @param vcs reference to the vcs object |
|
26 @param parent parent widget (QWidget) |
|
27 """ |
|
28 super().__init__(parent) |
|
29 self.setupUi(self) |
|
30 |
|
31 opt = vcs.vcsGetOptions() |
|
32 self.globalEdit.setText(" ".join(opt['global'])) |
|
33 self.commitEdit.setText(" ".join(opt['commit'])) |
|
34 self.checkoutEdit.setText(" ".join(opt['checkout'])) |
|
35 self.updateEdit.setText(" ".join(opt['update'])) |
|
36 self.addEdit.setText(" ".join(opt['add'])) |
|
37 self.removeEdit.setText(" ".join(opt['remove'])) |
|
38 self.diffEdit.setText(" ".join(opt['diff'])) |
|
39 self.logEdit.setText(" ".join(opt['log'])) |
|
40 self.historyEdit.setText(" ".join(opt['history'])) |
|
41 self.statusEdit.setText(" ".join(opt['status'])) |
|
42 self.tagEdit.setText(" ".join(opt['tag'])) |
|
43 self.exportEdit.setText(" ".join(opt['export'])) |
|
44 |
|
45 # modify the what's this help |
|
46 for widget in [self.globalEdit, self.commitEdit, self.checkoutEdit, |
|
47 self.updateEdit, self.addEdit, self.removeEdit, |
|
48 self.diffEdit, self.logEdit, self.historyEdit, |
|
49 self.statusEdit, self.tagEdit, self.exportEdit]: |
|
50 t = widget.whatsThis() |
|
51 if t: |
|
52 t += Utilities.getPercentReplacementHelp() |
|
53 widget.setWhatsThis(t) |
|
54 |
|
55 msh = self.minimumSizeHint() |
|
56 self.resize(max(self.width(), msh.width()), msh.height()) |
|
57 |
|
58 def getOptions(self): |
|
59 """ |
|
60 Public method used to retrieve the entered options. |
|
61 |
|
62 @return dictionary of strings giving the options for each supported |
|
63 vcs command |
|
64 """ |
|
65 opt = {} |
|
66 opt['global'] = Utilities.parseOptionString(self.globalEdit.text()) |
|
67 opt['commit'] = Utilities.parseOptionString(self.commitEdit.text()) |
|
68 opt['checkout'] = Utilities.parseOptionString(self.checkoutEdit.text()) |
|
69 opt['update'] = Utilities.parseOptionString(self.updateEdit.text()) |
|
70 opt['add'] = Utilities.parseOptionString(self.addEdit.text()) |
|
71 opt['remove'] = Utilities.parseOptionString(self.removeEdit.text()) |
|
72 opt['diff'] = Utilities.parseOptionString(self.diffEdit.text()) |
|
73 opt['log'] = Utilities.parseOptionString(self.logEdit.text()) |
|
74 opt['history'] = Utilities.parseOptionString(self.historyEdit.text()) |
|
75 opt['status'] = Utilities.parseOptionString(self.statusEdit.text()) |
|
76 opt['tag'] = Utilities.parseOptionString(self.tagEdit.text()) |
|
77 opt['export'] = Utilities.parseOptionString(self.exportEdit.text()) |
|
78 return opt |
|
79 |
|
80 # |
|
81 # eflag: noqa = C112 |