oqtopus 0.1.19__tar.gz → 0.1.20__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {oqtopus-0.1.19 → oqtopus-0.1.20}/PKG-INFO +1 -1
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/gui/database_connection_widget.py +9 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/gui/database_create_dialog.py +4 -8
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/gui/database_duplicate_dialog.py +33 -12
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/ui/database_create_dialog.ui +33 -36
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus.egg-info/PKG-INFO +1 -1
- {oqtopus-0.1.19 → oqtopus-0.1.20}/LICENSE +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/README.md +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/__init__.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/core/module.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/core/module_asset.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/core/module_package.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/core/modules_config.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/core/package_prepare_task.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/gui/__init__.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/gui/about_dialog.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/gui/logs_widget.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/gui/main_dialog.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/gui/module_selection_widget.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/gui/module_widget.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/gui/parameters_groupbox.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/gui/plugin_widget.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/gui/project_widget.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/gui/settings_dialog.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/oqtopus.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/oqtopus_plugin.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/ui/__init__.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/ui/about_dialog.ui +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/ui/database_connection_widget.ui +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/ui/database_duplicate_dialog.ui +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/ui/logs_widget.ui +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/ui/main_dialog.ui +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/ui/module_selection_widget.ui +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/ui/module_widget.ui +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/ui/plugin_widget.ui +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/ui/project_widget.ui +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/ui/settings_dialog.ui +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/utils/__init__.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/utils/plugin_utils.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/utils/qt_utils.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/utils/tmmtlogging.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus/utils/translation.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus.egg-info/SOURCES.txt +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus.egg-info/dependency_links.txt +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus.egg-info/requires.txt +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/oqtopus.egg-info/top_level.txt +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/pyproject.toml +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/setup.cfg +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/tests/__init__.py +0 -0
- {oqtopus-0.1.19 → oqtopus-0.1.20}/tests/test_plugin_load.py +0 -0
|
@@ -152,9 +152,18 @@ class DatabaseConnectionWidget(QWidget, DIALOG_UI):
|
|
|
152
152
|
databaseDuplicateDialog = DatabaseDuplicateDialog(
|
|
153
153
|
selected_service=self.db_services_comboBox.currentText(), parent=self
|
|
154
154
|
)
|
|
155
|
+
|
|
156
|
+
# Close the current connection otherwise it will block the database duplication
|
|
157
|
+
if self.__database_connection is not None:
|
|
158
|
+
self.__database_connection.close()
|
|
159
|
+
self.__database_connection = None
|
|
160
|
+
|
|
155
161
|
if databaseDuplicateDialog.exec() == QDialog.DialogCode.Rejected:
|
|
162
|
+
self.__serviceChanged()
|
|
156
163
|
return
|
|
157
164
|
|
|
165
|
+
self.__loadDatabaseInformations()
|
|
166
|
+
|
|
158
167
|
def __set_connection(self, connection):
|
|
159
168
|
"""
|
|
160
169
|
Set the current database connection and emit the signal_connectionChanged signal.
|
|
@@ -73,8 +73,6 @@ class DatabaseCreateDialog(QDialog, DIALOG_UI):
|
|
|
73
73
|
self.parameters_port_lineEdit.setPlaceholderText(DEFAULT_PG_PORT)
|
|
74
74
|
self.parameters_database_lineEdit.setPlaceholderText(DEFAULT_PG_DB)
|
|
75
75
|
|
|
76
|
-
self.database_lineEdit.textChanged.connect(self._databaseTextChanged)
|
|
77
|
-
|
|
78
76
|
self.buttonBox.accepted.connect(self._accept)
|
|
79
77
|
|
|
80
78
|
if self.existingService_comboBox.count() > 0:
|
|
@@ -106,9 +104,6 @@ class DatabaseCreateDialog(QDialog, DIALOG_UI):
|
|
|
106
104
|
def _enterManuallyToggled(self, checked):
|
|
107
105
|
self.parameters_frame.setEnabled(checked)
|
|
108
106
|
|
|
109
|
-
def _databaseTextChanged(self, text):
|
|
110
|
-
self.database_label.setText(text)
|
|
111
|
-
|
|
112
107
|
def _accept(self):
|
|
113
108
|
service_name = self.created_service_name()
|
|
114
109
|
|
|
@@ -193,9 +188,10 @@ class DatabaseCreateDialog(QDialog, DIALOG_UI):
|
|
|
193
188
|
service_name = self.existingService_comboBox.currentText()
|
|
194
189
|
existing_settings = pgserviceparser_service_config(service_name)
|
|
195
190
|
settings.update(existing_settings)
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
191
|
+
|
|
192
|
+
# Overwrite dbname with the new database name
|
|
193
|
+
if self.database_lineEdit.text():
|
|
194
|
+
settings["dbname"] = self.database_lineEdit.text()
|
|
199
195
|
|
|
200
196
|
return settings
|
|
201
197
|
|
|
@@ -23,11 +23,13 @@
|
|
|
23
23
|
# ---------------------------------------------------------------------
|
|
24
24
|
|
|
25
25
|
import psycopg
|
|
26
|
+
from pgserviceparser import full_config as pgserviceparser_full_config
|
|
26
27
|
from pgserviceparser import service_config as pgserviceparser_service_config
|
|
28
|
+
from pgserviceparser import write_service as pgserviceparser_write_service
|
|
27
29
|
from qgis.PyQt.QtCore import Qt
|
|
28
30
|
from qgis.PyQt.QtWidgets import QDialog, QMessageBox
|
|
29
31
|
|
|
30
|
-
from ..utils.plugin_utils import PluginUtils
|
|
32
|
+
from ..utils.plugin_utils import PluginUtils, logger
|
|
31
33
|
from ..utils.qt_utils import OverrideCursor
|
|
32
34
|
|
|
33
35
|
DIALOG_UI = PluginUtils.get_ui_class("database_duplicate_dialog.ui")
|
|
@@ -61,6 +63,23 @@ class DatabaseDuplicateDialog(QDialog, DIALOG_UI):
|
|
|
61
63
|
|
|
62
64
|
except Exception as exception:
|
|
63
65
|
errorText = self.tr(f"Can't connect to service '{service_name}':\n{exception}.")
|
|
66
|
+
logger.error(errorText)
|
|
67
|
+
QMessageBox.critical(self, "Error", errorText)
|
|
68
|
+
return
|
|
69
|
+
|
|
70
|
+
# Create new service configuration
|
|
71
|
+
new_service_name = self.newService_lineEdit.text()
|
|
72
|
+
|
|
73
|
+
# Check if the new service name is already in use
|
|
74
|
+
try:
|
|
75
|
+
if new_service_name in pgserviceparser_full_config():
|
|
76
|
+
errorText = self.tr(f"Service name '{new_service_name}' is already in use.")
|
|
77
|
+
logger.error(errorText)
|
|
78
|
+
QMessageBox.critical(self, "Error", errorText)
|
|
79
|
+
return
|
|
80
|
+
except Exception as e:
|
|
81
|
+
errorText = self.tr(f"Error checking existing service names:\n{e}.")
|
|
82
|
+
logger.error(errorText)
|
|
64
83
|
QMessageBox.critical(self, "Error", errorText)
|
|
65
84
|
return
|
|
66
85
|
|
|
@@ -75,25 +94,27 @@ class DatabaseDuplicateDialog(QDialog, DIALOG_UI):
|
|
|
75
94
|
)
|
|
76
95
|
except psycopg.Error as e:
|
|
77
96
|
errorText = self.tr(f"Error duplicating database:\n{e}.")
|
|
97
|
+
logger.error(errorText)
|
|
78
98
|
QMessageBox.critical(self, "Error", errorText)
|
|
79
99
|
return
|
|
80
100
|
finally:
|
|
81
101
|
database_connection.close()
|
|
82
102
|
|
|
83
|
-
#
|
|
84
|
-
new_service_name = self.newService_lineEdit.text()
|
|
85
|
-
new_service_config = pgserviceparser_service_config(
|
|
86
|
-
new_service_name,
|
|
87
|
-
dbname=new_database_name,
|
|
88
|
-
host=self.__existing_service_config.get("host", ""),
|
|
89
|
-
port=self.__existing_service_config.get("port", ""),
|
|
90
|
-
user=self.__existing_service_config.get("user", ""),
|
|
91
|
-
password=self.__existing_service_config.get("password", ""),
|
|
92
|
-
)
|
|
103
|
+
# Write the new service configuration
|
|
93
104
|
try:
|
|
94
|
-
|
|
105
|
+
new_service_config = {
|
|
106
|
+
"dbname": new_database_name,
|
|
107
|
+
"host": self.__existing_service_config.get("host", ""),
|
|
108
|
+
"port": self.__existing_service_config.get("port", ""),
|
|
109
|
+
"user": self.__existing_service_config.get("user", ""),
|
|
110
|
+
"password": self.__existing_service_config.get("password", ""),
|
|
111
|
+
}
|
|
112
|
+
pgserviceparser_write_service(
|
|
113
|
+
new_service_name, new_service_config, create_if_not_found=True
|
|
114
|
+
)
|
|
95
115
|
except Exception as e:
|
|
96
116
|
errorText = self.tr(f"Error writing new service configuration:\n{e}.")
|
|
117
|
+
logger.error(errorText)
|
|
97
118
|
QMessageBox.critical(self, "Error", errorText)
|
|
98
119
|
return
|
|
99
120
|
|
|
@@ -11,13 +11,16 @@
|
|
|
11
11
|
</rect>
|
|
12
12
|
</property>
|
|
13
13
|
<property name="windowTitle">
|
|
14
|
-
<string>Create
|
|
14
|
+
<string>Create Database</string>
|
|
15
15
|
</property>
|
|
16
16
|
<layout class="QVBoxLayout" name="verticalLayout">
|
|
17
17
|
<item>
|
|
18
18
|
<widget class="QGroupBox" name="groupBox_2">
|
|
19
|
+
<property name="toolTip">
|
|
20
|
+
<string><html><head/><body><p>To issue a <span style=" font-style:italic;">CREATE DATABASE</span> command, you must first be connected to the PostgreSQL server. Select an existing administrative connection (often named postgres) from a service or manually.<br/>This connection is used to perform the creation action, and as a template for the new service to be created.</p></body></html></string>
|
|
21
|
+
</property>
|
|
19
22
|
<property name="title">
|
|
20
|
-
<string>
|
|
23
|
+
<string>Connection to use</string>
|
|
21
24
|
</property>
|
|
22
25
|
<layout class="QGridLayout" name="gridLayout_2">
|
|
23
26
|
<item row="0" column="1">
|
|
@@ -164,25 +167,6 @@
|
|
|
164
167
|
</attribute>
|
|
165
168
|
</widget>
|
|
166
169
|
</item>
|
|
167
|
-
<item row="6" column="1">
|
|
168
|
-
<widget class="QLineEdit" name="database_lineEdit">
|
|
169
|
-
<property name="font">
|
|
170
|
-
<font>
|
|
171
|
-
<italic>false</italic>
|
|
172
|
-
</font>
|
|
173
|
-
</property>
|
|
174
|
-
<property name="text">
|
|
175
|
-
<string/>
|
|
176
|
-
</property>
|
|
177
|
-
</widget>
|
|
178
|
-
</item>
|
|
179
|
-
<item row="6" column="0">
|
|
180
|
-
<widget class="QLabel" name="label_4">
|
|
181
|
-
<property name="text">
|
|
182
|
-
<string>Database</string>
|
|
183
|
-
</property>
|
|
184
|
-
</widget>
|
|
185
|
-
</item>
|
|
186
170
|
<item row="0" column="0">
|
|
187
171
|
<widget class="QRadioButton" name="useService_radioButton">
|
|
188
172
|
<property name="text">
|
|
@@ -202,35 +186,48 @@
|
|
|
202
186
|
<item>
|
|
203
187
|
<widget class="QGroupBox" name="groupBox">
|
|
204
188
|
<property name="title">
|
|
205
|
-
<string>
|
|
189
|
+
<string>New database</string>
|
|
206
190
|
</property>
|
|
207
191
|
<layout class="QGridLayout" name="gridLayout_3">
|
|
208
|
-
<item row="
|
|
192
|
+
<item row="1" column="0">
|
|
209
193
|
<widget class="QLabel" name="label">
|
|
194
|
+
<property name="toolTip">
|
|
195
|
+
<string>Enter a convenient alias that will be created in your pg_service.conf file.</string>
|
|
196
|
+
</property>
|
|
210
197
|
<property name="text">
|
|
211
|
-
<string>Service</string>
|
|
198
|
+
<string>Service name</string>
|
|
212
199
|
</property>
|
|
213
200
|
</widget>
|
|
214
201
|
</item>
|
|
215
|
-
<item row="0" column="1">
|
|
216
|
-
<widget class="QLineEdit" name="service_lineEdit"/>
|
|
217
|
-
</item>
|
|
218
202
|
<item row="1" column="1">
|
|
219
|
-
<widget class="
|
|
220
|
-
<property name="
|
|
221
|
-
<font>
|
|
222
|
-
|
|
223
|
-
|
|
203
|
+
<widget class="QLineEdit" name="service_lineEdit">
|
|
204
|
+
<property name="toolTip">
|
|
205
|
+
<string><html><head/><body><p>Enter a convenient alias that will be created in your <span style=" font-style:italic;">pg_service.conf</span> file.</p></body></html></string>
|
|
206
|
+
</property>
|
|
207
|
+
</widget>
|
|
208
|
+
</item>
|
|
209
|
+
<item row="0" column="0">
|
|
210
|
+
<widget class="QLabel" name="label_4">
|
|
211
|
+
<property name="toolTip">
|
|
212
|
+
<string>Enter the actual name for the new database as it will exist inside your PostgreSQL installation.</string>
|
|
224
213
|
</property>
|
|
225
214
|
<property name="text">
|
|
226
|
-
<string
|
|
215
|
+
<string>Database name</string>
|
|
227
216
|
</property>
|
|
228
217
|
</widget>
|
|
229
218
|
</item>
|
|
230
|
-
<item row="
|
|
231
|
-
<widget class="
|
|
219
|
+
<item row="0" column="1">
|
|
220
|
+
<widget class="QLineEdit" name="database_lineEdit">
|
|
221
|
+
<property name="font">
|
|
222
|
+
<font>
|
|
223
|
+
<italic>false</italic>
|
|
224
|
+
</font>
|
|
225
|
+
</property>
|
|
226
|
+
<property name="toolTip">
|
|
227
|
+
<string>Enter the actual name for the new database as it will exist inside your PostgreSQL installation.</string>
|
|
228
|
+
</property>
|
|
232
229
|
<property name="text">
|
|
233
|
-
<string
|
|
230
|
+
<string/>
|
|
234
231
|
</property>
|
|
235
232
|
</widget>
|
|
236
233
|
</item>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|