17 from E5Gui import E5FileDialog |
17 from E5Gui import E5FileDialog |
18 |
18 |
19 from .Ui_SqlConnectionDialog import Ui_SqlConnectionDialog |
19 from .Ui_SqlConnectionDialog import Ui_SqlConnectionDialog |
20 |
20 |
21 import Utilities |
21 import Utilities |
|
22 import UI.PixmapCache |
22 |
23 |
23 |
24 |
24 class SqlConnectionDialog(QDialog, Ui_SqlConnectionDialog): |
25 class SqlConnectionDialog(QDialog, Ui_SqlConnectionDialog): |
25 """ |
26 """ |
26 Class implementing a dialog to enter the connection parameters. |
27 Class implementing a dialog to enter the connection parameters. |
31 |
32 |
32 @param parent reference to the parent widget (QWidget) |
33 @param parent reference to the parent widget (QWidget) |
33 """ |
34 """ |
34 super(SqlConnectionDialog, self).__init__(parent) |
35 super(SqlConnectionDialog, self).__init__(parent) |
35 self.setupUi(self) |
36 self.setupUi(self) |
|
37 |
|
38 self.databaseFileButton.setIcon(UI.PixmapCache.getIcon("open.png")) |
36 |
39 |
37 self.databaseFileCompleter = E5FileCompleter() |
40 self.databaseFileCompleter = E5FileCompleter() |
38 |
41 |
39 self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) |
42 self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) |
40 |
43 |
53 drivers.remove("QTDS7") |
56 drivers.remove("QTDS7") |
54 |
57 |
55 self.driverCombo.addItems(drivers) |
58 self.driverCombo.addItems(drivers) |
56 |
59 |
57 self.__updateDialog() |
60 self.__updateDialog() |
|
61 |
|
62 msh = self.minimumSizeHint() |
|
63 self.resize(max(self.width(), msh.width()), msh.height()) |
58 |
64 |
59 def __updateDialog(self): |
65 def __updateDialog(self): |
60 """ |
66 """ |
61 Private slot to update the dialog depending on its contents. |
67 Private slot to update the dialog depending on its contents. |
62 """ |
68 """ |
97 Private slot to open a database file via a file selection dialog. |
103 Private slot to open a database file via a file selection dialog. |
98 """ |
104 """ |
99 startdir = self.databaseEdit.text() |
105 startdir = self.databaseEdit.text() |
100 dbFile = E5FileDialog.getOpenFileName( |
106 dbFile = E5FileDialog.getOpenFileName( |
101 self, |
107 self, |
102 self.trUtf8("Select Database File"), |
108 self.tr("Select Database File"), |
103 startdir, |
109 startdir, |
104 self.trUtf8("All Files (*)")) |
110 self.tr("All Files (*)")) |
105 |
111 |
106 if dbFile: |
112 if dbFile: |
107 self.databaseEdit.setText(Utilities.toNativeSeparators(dbFile)) |
113 self.databaseEdit.setText(Utilities.toNativeSeparators(dbFile)) |
108 |
114 |
109 def getData(self): |
115 def getData(self): |