-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[gui] Add tab for listing and managing (add/edit/remove) connections …
…to a particular service; refactor ServiceNameDialog to also handle connection names
- Loading branch information
1 parent
012a86c
commit 47cf2a3
Showing
8 changed files
with
308 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from enum import Enum | ||
|
||
from qgis.PyQt.QtCore import pyqtSlot | ||
from qgis.PyQt.QtWidgets import QDialog, QWidget | ||
|
||
from pg_service_parser.utils import get_ui_class | ||
|
||
DIALOG_UI = get_ui_class("new_name_dialog.ui") | ||
|
||
|
||
class EnumNewName(Enum): | ||
SERVICE = 0 | ||
CONNECTION = 1 | ||
|
||
|
||
class NewNameDialog(QDialog, DIALOG_UI): | ||
|
||
def __init__(self, mode: EnumNewName, parent: QWidget, data: str = "") -> None: | ||
QDialog.__init__(self, parent) | ||
self.setupUi(self) | ||
self.__mode = mode | ||
|
||
self.buttonBox.accepted.connect(self.__accepted) | ||
|
||
if self.__mode == EnumNewName.SERVICE: | ||
self.setWindowTitle("Service name") | ||
self.label.setText("Enter a service name") | ||
self.txtNewName.setPlaceholderText("e.g., my-service") | ||
self.new_name = "my-service" | ||
elif self.__mode == EnumNewName.CONNECTION: | ||
self.setWindowTitle("Connection name") | ||
self.label.setText("Enter a connection name") | ||
self.txtNewName.setPlaceholderText("e.g., My Service Connection") | ||
self.new_name = f"{data} connection" | ||
|
||
@pyqtSlot() | ||
def __accepted(self): | ||
if self.txtNewName.text().strip(): | ||
if self.__mode == EnumNewName.SERVICE: | ||
self.new_name = self.txtNewName.text().strip().replace(" ", "-") | ||
elif self.__mode == EnumNewName.CONNECTION: | ||
self.new_name = self.txtNewName.text().strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.