37 """ |
38 """ |
38 super().__init__(parent) |
39 super().__init__(parent) |
39 self.setupUi(self) |
40 self.setupUi(self) |
40 SvnDialogMixin.__init__(self, log) |
41 SvnDialogMixin.__init__(self, log) |
41 self.setWindowFlags(Qt.WindowType.Window) |
42 self.setWindowFlags(Qt.WindowType.Window) |
42 |
43 |
43 self.buttonBox.button( |
44 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False) |
44 QDialogButtonBox.StandardButton.Close).setEnabled(False) |
45 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
45 self.buttonBox.button( |
46 |
46 QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
|
47 |
|
48 self.outputGroup.setTitle(text) |
47 self.outputGroup.setTitle(text) |
49 self.errorGroup.hide() |
48 self.errorGroup.hide() |
50 |
49 |
51 pysvnClient.callback_cancel = self._clientCancelCallback |
50 pysvnClient.callback_cancel = self._clientCancelCallback |
52 |
51 |
53 pysvnClient.callback_notify = self._clientNotifyCallback |
52 pysvnClient.callback_notify = self._clientNotifyCallback |
54 pysvnClient.callback_get_login = self._clientLoginCallback |
53 pysvnClient.callback_get_login = self._clientLoginCallback |
55 pysvnClient.callback_ssl_server_trust_prompt = ( |
54 pysvnClient.callback_ssl_server_trust_prompt = ( |
56 self._clientSslServerTrustPromptCallback |
55 self._clientSslServerTrustPromptCallback |
57 ) |
56 ) |
58 pysvnClient.callback_get_log_message = self._clientLogCallback |
57 pysvnClient.callback_get_log_message = self._clientLogCallback |
59 |
58 |
60 self.__hasAddOrDelete = False |
59 self.__hasAddOrDelete = False |
61 |
60 |
62 if command: |
61 if command: |
63 self.resultbox.append(command) |
62 self.resultbox.append(command) |
64 self.resultbox.append('') |
63 self.resultbox.append("") |
65 |
64 |
66 self.show() |
65 self.show() |
67 QApplication.processEvents() |
66 QApplication.processEvents() |
68 |
67 |
69 def _clientNotifyCallback(self, eventDict): |
68 def _clientNotifyCallback(self, eventDict): |
70 """ |
69 """ |
71 Protected method called by the client to send events. |
70 Protected method called by the client to send events. |
72 |
71 |
73 @param eventDict dictionary containing the notification event |
72 @param eventDict dictionary containing the notification event |
74 """ |
73 """ |
75 msg = "" |
74 msg = "" |
76 if eventDict["action"] == pysvn.wc_notify_action.update_completed: |
75 if eventDict["action"] == pysvn.wc_notify_action.update_completed: |
77 msg = self.tr("Revision {0}.\n").format( |
76 msg = self.tr("Revision {0}.\n").format(eventDict["revision"].number) |
78 eventDict["revision"].number) |
|
79 elif ( |
77 elif ( |
80 eventDict["path"] != "" and |
78 eventDict["path"] != "" |
81 eventDict["action"] in svnNotifyActionMap and |
79 and eventDict["action"] in svnNotifyActionMap |
82 svnNotifyActionMap[eventDict["action"]] is not None |
80 and svnNotifyActionMap[eventDict["action"]] is not None |
83 ): |
81 ): |
84 mime = ( |
82 mime = ( |
85 eventDict["mime_type"] == "application/octet-stream" and |
83 eventDict["mime_type"] == "application/octet-stream" |
86 self.tr(" (binary)") or "" |
84 and self.tr(" (binary)") |
|
85 or "" |
87 ) |
86 ) |
88 msg = self.tr("{0} {1}{2}\n").format( |
87 msg = self.tr("{0} {1}{2}\n").format( |
89 self.tr(svnNotifyActionMap[eventDict["action"]]), |
88 self.tr(svnNotifyActionMap[eventDict["action"]]), |
90 eventDict["path"], |
89 eventDict["path"], |
91 mime) |
90 mime, |
92 if ( |
91 ) |
93 '.epj' in eventDict["path"] or |
92 if ".epj" in eventDict["path"] or ".e4p" in eventDict["path"]: |
94 '.e4p' in eventDict["path"] |
|
95 ): |
|
96 self.__hasAddOrDelete = True |
93 self.__hasAddOrDelete = True |
97 if eventDict["action"] in [pysvn.wc_notify_action.add, |
94 if eventDict["action"] in [ |
98 pysvn.wc_notify_action.commit_added, |
95 pysvn.wc_notify_action.add, |
99 pysvn.wc_notify_action.commit_deleted, |
96 pysvn.wc_notify_action.commit_added, |
100 pysvn.wc_notify_action.delete, |
97 pysvn.wc_notify_action.commit_deleted, |
101 pysvn.wc_notify_action.update_add, |
98 pysvn.wc_notify_action.delete, |
102 pysvn.wc_notify_action.update_delete]: |
99 pysvn.wc_notify_action.update_add, |
|
100 pysvn.wc_notify_action.update_delete, |
|
101 ]: |
103 self.__hasAddOrDelete = True |
102 self.__hasAddOrDelete = True |
104 if msg: |
103 if msg: |
105 self.showMessage(msg) |
104 self.showMessage(msg) |
106 |
105 |
107 def showMessage(self, msg): |
106 def showMessage(self, msg): |
108 """ |
107 """ |
109 Public slot to show a message. |
108 Public slot to show a message. |
110 |
109 |
111 @param msg message to show (string) |
110 @param msg message to show (string) |
112 """ |
111 """ |
113 self.resultbox.insertPlainText(msg) |
112 self.resultbox.insertPlainText(msg) |
114 self.resultbox.ensureCursorVisible() |
113 self.resultbox.ensureCursorVisible() |
115 QApplication.processEvents() |
114 QApplication.processEvents() |
116 |
115 |
117 def showError(self, msg): |
116 def showError(self, msg): |
118 """ |
117 """ |
119 Public slot to show an error message. |
118 Public slot to show an error message. |
120 |
119 |
121 @param msg error message to show (string) |
120 @param msg error message to show (string) |
122 """ |
121 """ |
123 self.errorGroup.show() |
122 self.errorGroup.show() |
124 self.errors.insertPlainText(msg) |
123 self.errors.insertPlainText(msg) |
125 self.errors.ensureCursorVisible() |
124 self.errors.ensureCursorVisible() |
126 QApplication.processEvents() |
125 QApplication.processEvents() |
127 |
126 |
128 def finish(self): |
127 def finish(self): |
129 """ |
128 """ |
130 Public slot called when the process finished or the user pressed the |
129 Public slot called when the process finished or the user pressed the |
131 button. |
130 button. |
132 """ |
131 """ |
133 self.buttonBox.button( |
132 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(True) |
134 QDialogButtonBox.StandardButton.Close).setEnabled(True) |
133 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setEnabled(False) |
135 self.buttonBox.button( |
134 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setDefault(True) |
136 QDialogButtonBox.StandardButton.Cancel).setEnabled(False) |
135 |
137 self.buttonBox.button( |
|
138 QDialogButtonBox.StandardButton.Close).setDefault(True) |
|
139 |
|
140 self._cancel() |
136 self._cancel() |
141 |
137 |
142 if Preferences.getVCS("AutoClose"): |
138 if Preferences.getVCS("AutoClose"): |
143 self.accept() |
139 self.accept() |
144 |
140 |
145 def on_buttonBox_clicked(self, button): |
141 def on_buttonBox_clicked(self, button): |
146 """ |
142 """ |
147 Private slot called by a button of the button box clicked. |
143 Private slot called by a button of the button box clicked. |
148 |
144 |
149 @param button button that was clicked (QAbstractButton) |
145 @param button button that was clicked (QAbstractButton) |
150 """ |
146 """ |
151 if button == self.buttonBox.button( |
147 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close): |
152 QDialogButtonBox.StandardButton.Close |
|
153 ): |
|
154 self.close() |
148 self.close() |
155 elif button == self.buttonBox.button( |
149 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel): |
156 QDialogButtonBox.StandardButton.Cancel |
|
157 ): |
|
158 self.finish() |
150 self.finish() |
159 |
151 |
160 def hasAddOrDelete(self): |
152 def hasAddOrDelete(self): |
161 """ |
153 """ |
162 Public method to check, if the last action contained an add or delete. |
154 Public method to check, if the last action contained an add or delete. |
163 |
155 |
164 @return flag indicating the presence of an add or delete (boolean) |
156 @return flag indicating the presence of an add or delete (boolean) |
165 """ |
157 """ |
166 return self.__hasAddOrDelete |
158 return self.__hasAddOrDelete |