116 self.destinationEdit.setToolTip( |
116 self.destinationEdit.setToolTip( |
117 self.tr("Enter the destination package for the module") |
117 self.tr("Enter the destination package for the module") |
118 ) |
118 ) |
119 self.selectButton.setToolTip( |
119 self.selectButton.setToolTip( |
120 self.tr( |
120 self.tr( |
121 "Select the destination package via a directory selection" " dialog" |
121 "Select the destination package via a directory selection dialog" |
122 ) |
122 ) |
123 ) |
123 ) |
124 else: |
124 else: |
125 self.setWindowTitle(self.tr("Move")) |
125 self.setWindowTitle(self.tr("Move")) |
126 self.moveStackWidget.setCurrentIndex(0) |
126 self.moveStackWidget.setCurrentIndex(0) |
129 |
129 |
130 msh = self.minimumSizeHint() |
130 msh = self.minimumSizeHint() |
131 self.resize(max(self.width(), msh.width()), msh.height()) |
131 self.resize(max(self.width(), msh.width()), msh.height()) |
132 |
132 |
133 @pyqtSlot(str) |
133 @pyqtSlot(str) |
134 def on_attributeEdit_textChanged(self, text): |
134 def on_attributeEdit_textChanged(self, text): # noqa: U100 |
135 """ |
135 """ |
136 Private slot to react to changes of the attribute. |
136 Private slot to react to changes of the attribute. |
137 |
137 |
138 @param text text entered into the edit |
138 @param text text entered into the edit |
139 @type str |
139 @type str |
140 """ |
140 """ |
141 self.__updateUI() |
141 self.__updateUI() |
142 |
142 |
143 @pyqtSlot(str) |
143 @pyqtSlot(str) |
144 def on_methodEdit_textChanged(self, text): |
144 def on_methodEdit_textChanged(self, text): # noqa: U100 |
145 """ |
145 """ |
146 Private slot to react to changes of the method. |
146 Private slot to react to changes of the method. |
147 |
147 |
148 @param text text entered into the edit |
148 @param text text entered into the edit |
149 @type str |
149 @type str |
150 """ |
150 """ |
151 self.__updateUI() |
151 self.__updateUI() |
152 |
152 |
153 @pyqtSlot(str) |
153 @pyqtSlot(str) |
154 def on_destinationEdit_textChanged(self, text): |
154 def on_destinationEdit_textChanged(self, text): # noqa: U100 |
155 """ |
155 """ |
156 Private slot to react to changes of the destination module. |
156 Private slot to react to changes of the destination module. |
157 |
157 |
158 @param text text entered into the edit |
158 @param text text entered into the edit |
159 @type str |
159 @type str |
201 if destination: |
201 if destination: |
202 destination = toNativeSeparators(destination) |
202 destination = toNativeSeparators(destination) |
203 if not self.__project.startswithProjectPath(destination): |
203 if not self.__project.startswithProjectPath(destination): |
204 if self.__moveType == "move_global_method": |
204 if self.__moveType == "move_global_method": |
205 errorMessage = self.tr( |
205 errorMessage = self.tr( |
206 """The selected module must be """ """inside the project.""" |
206 """The selected module must be inside the project.""" |
207 ) |
207 ) |
208 else: |
208 else: |
209 # move_module |
209 # move_module |
210 errorMessage = self.tr( |
210 errorMessage = self.tr( |
211 """The selected directory must""" """ be inside the project.""" |
211 """The selected directory must be inside the project.""" |
212 ) |
212 ) |
213 EricMessageBox.critical(self, self.windowTitle(), errorMessage) |
213 EricMessageBox.critical(self, self.windowTitle(), errorMessage) |
214 return |
214 return |
215 |
215 |
216 if self.__moveType == "move_global_method": |
216 if self.__moveType == "move_global_method": |
217 if not os.path.exists(destination): |
217 if not os.path.exists(destination): |
218 EricMessageBox.critical( |
218 EricMessageBox.critical( |
219 self, |
219 self, |
220 self.windowTitle(), |
220 self.windowTitle(), |
221 self.tr( |
221 self.tr( |
222 """The selected module <b>{0}</b> does""" """ not exist.""" |
222 """The selected module <b>{0}</b> does not exist.""" |
223 ).format(destination), |
223 ).format(destination), |
224 ) |
224 ) |
225 return |
225 return |
226 else: |
226 else: |
227 # move_module |
227 # move_module |
253 if not os.path.exists(destination): |
253 if not os.path.exists(destination): |
254 EricMessageBox.critical( |
254 EricMessageBox.critical( |
255 self, |
255 self, |
256 self.windowTitle(), |
256 self.windowTitle(), |
257 self.tr( |
257 self.tr( |
258 """The selected module <b>{0}</b> does""" """ not exist.""" |
258 """The selected module <b>{0}</b> does not exist.""" |
259 ).format(destination), |
259 ).format(destination), |
260 ) |
260 ) |
261 return False |
261 return False |
262 else: |
262 else: |
263 # move_module |
263 # move_module |
264 if not os.path.exists(os.path.join(destination, "__init__.py")): |
264 if not os.path.exists(os.path.join(destination, "__init__.py")): |
265 EricMessageBox.critical( |
265 EricMessageBox.critical( |
266 self, |
266 self, |
267 self.windowTitle(), |
267 self.windowTitle(), |
268 self.tr( |
268 self.tr( |
269 """The selected directory <b>{0}</b> is""" """ not a package.""" |
269 """The selected directory <b>{0}</b> is not a package.""" |
270 ).format(destination), |
270 ).format(destination), |
271 ) |
271 ) |
272 return False |
272 return False |
273 |
273 |
274 return True |
274 return True |