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