RefactoringRope/ConfigurationPage/MouseClickHandlerRopePage.py

Wed, 30 Dec 2020 11:02:11 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 30 Dec 2020 11:02:11 +0100
changeset 346
877cac2e8d94
parent 341
c43844eb47b7
child 347
b5048b5ff454
permissions
-rw-r--r--

Updated copyright for 2021.

129
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
346
877cac2e8d94 Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 341
diff changeset
3 # Copyright (c) 2015 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
129
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the Rope Mouse Click Handler configuration page.
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
151
5260100b6700 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
10 from __future__ import unicode_literals
5260100b6700 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
11
129
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from PyQt5.QtCore import pyqtSlot
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from PyQt5.QtWidgets import QDialog
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
320
91b171fdd85f Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 302
diff changeset
15 from Preferences.ConfigurationPages.ConfigurationPageBase import (
129
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 ConfigurationPageBase
320
91b171fdd85f Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 302
diff changeset
17 )
129
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 from .Ui_MouseClickHandlerRopePage import Ui_MouseClickHandlerRopePage
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 from Utilities import MouseUtilities
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 from Preferences.MouseClickDialog import MouseClickDialog
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 class MouseClickHandlerRopePage(ConfigurationPageBase,
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 Ui_MouseClickHandlerRopePage):
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 """
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 Class implementing the Rope Mouse Click Handler configuration page.
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 """
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 def __init__(self, plugin):
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 """
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 Constructor
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 @param plugin reference to the plugin object
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 @type RefactoringRopePlugin
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 """
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 ConfigurationPageBase.__init__(self)
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.setupUi(self)
132
5384651b27c7 Fixed an issue in the mouse click configuration page causing a wrong object name being set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 129
diff changeset
38 self.setObjectName("MouseClickHandlerRopePage")
129
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 self.__plugin = plugin
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 # set initial values
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 self.__modifiers = {
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 "goto": (
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 self.__plugin.getPreferences("MouseClickGotoModifiers"),
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 self.__plugin.getPreferences("MouseClickGotoButton")
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 )
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 }
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 self.ropeClickHandlerCheckBox.setChecked(
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 self.__plugin.getPreferences("MouseClickEnabled"))
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 self.gotoClickEdit.setText(MouseUtilities.MouseButtonModifier2String(
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 *self.__modifiers["goto"]))
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 def save(self):
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 """
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 Public slot to save the Rope Mouse Click Handler configuration.
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 """
133
6fb6ac582a39 Adjusted to slightly extended Editor API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 132
diff changeset
59 self.__plugin.setPreferences(
6fb6ac582a39 Adjusted to slightly extended Editor API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 132
diff changeset
60 "MouseClickEnabled",
129
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 self.ropeClickHandlerCheckBox.isChecked())
133
6fb6ac582a39 Adjusted to slightly extended Editor API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 132
diff changeset
62 self.__plugin.setPreferences(
6fb6ac582a39 Adjusted to slightly extended Editor API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 132
diff changeset
63 "MouseClickGotoModifiers",
129
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 int(self.__modifiers["goto"][0]))
133
6fb6ac582a39 Adjusted to slightly extended Editor API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 132
diff changeset
65 self.__plugin.setPreferences(
6fb6ac582a39 Adjusted to slightly extended Editor API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 132
diff changeset
66 "MouseClickGotoButton",
129
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 int(self.__modifiers["goto"][1]))
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 @pyqtSlot()
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 def on_changeGotoButton_clicked(self):
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 """
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 Private slot to change the 'goto' mouse click sequence.
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 """
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 dlg = MouseClickDialog(*self.__modifiers["goto"])
341
c43844eb47b7 Changed calls of exec_() into exec().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 326
diff changeset
75 if dlg.exec() == QDialog.Accepted:
129
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 self.__modifiers["goto"] = dlg.getClick()
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 self.gotoClickEdit.setText(
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 MouseUtilities.MouseButtonModifier2String(
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 *self.__modifiers["goto"]))

eric ide

mercurial