9 |
9 |
10 from PyQt6.QtCore import QTimer, QUrl |
10 from PyQt6.QtCore import QTimer, QUrl |
11 from PyQt6.QtGui import QKeySequence |
11 from PyQt6.QtGui import QKeySequence |
12 from PyQt6.QtSql import QSqlError, QSqlDatabase |
12 from PyQt6.QtSql import QSqlError, QSqlDatabase |
13 |
13 |
14 from EricGui.EricAction import EricAction |
14 from eric7.EricGui.EricAction import EricAction |
15 from EricWidgets import EricMessageBox |
15 from eric7.EricWidgets import EricMessageBox |
16 from EricWidgets.EricMainWindow import EricMainWindow |
16 from eric7.EricWidgets.EricMainWindow import EricMainWindow |
17 from EricWidgets.EricApplication import ericApp |
17 from eric7.EricWidgets.EricApplication import ericApp |
18 |
18 |
19 import UI.PixmapCache |
19 from eric7.EricGui import EricPixmapCache |
20 import UI.Config |
20 from eric7.UI import Config |
21 |
21 |
22 import Preferences |
22 from eric7 import Preferences |
23 |
23 |
24 |
24 |
25 class SqlBrowser(EricMainWindow): |
25 class SqlBrowser(EricMainWindow): |
26 """ |
26 """ |
27 Class implementing the SQL Browser main window. |
27 Class implementing the SQL Browser main window. |
40 |
40 |
41 if connections is None: |
41 if connections is None: |
42 connections = [] |
42 connections = [] |
43 |
43 |
44 self.setWindowTitle(self.tr("SQL Browser")) |
44 self.setWindowTitle(self.tr("SQL Browser")) |
45 self.setWindowIcon(UI.PixmapCache.getIcon("eric")) |
45 self.setWindowIcon(EricPixmapCache.getIcon("eric")) |
46 |
46 |
47 self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) |
47 self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) |
48 |
48 |
49 from .SqlBrowserWidget import SqlBrowserWidget |
49 from .SqlBrowserWidget import SqlBrowserWidget |
50 |
50 |
102 # list of all actions |
102 # list of all actions |
103 self.__actions = [] |
103 self.__actions = [] |
104 |
104 |
105 self.addConnectionAct = EricAction( |
105 self.addConnectionAct = EricAction( |
106 self.tr("Add Connection"), |
106 self.tr("Add Connection"), |
107 UI.PixmapCache.getIcon("databaseConnection"), |
107 EricPixmapCache.getIcon("databaseConnection"), |
108 self.tr("Add &Connection..."), |
108 self.tr("Add &Connection..."), |
109 0, |
109 0, |
110 0, |
110 0, |
111 self, |
111 self, |
112 "sql_file_add_connection", |
112 "sql_file_add_connection", |
124 self.addConnectionAct.triggered.connect(self.__browser.addConnectionByDialog) |
124 self.addConnectionAct.triggered.connect(self.__browser.addConnectionByDialog) |
125 self.__actions.append(self.addConnectionAct) |
125 self.__actions.append(self.addConnectionAct) |
126 |
126 |
127 self.exitAct = EricAction( |
127 self.exitAct = EricAction( |
128 self.tr("Quit"), |
128 self.tr("Quit"), |
129 UI.PixmapCache.getIcon("exit"), |
129 EricPixmapCache.getIcon("exit"), |
130 self.tr("&Quit"), |
130 self.tr("&Quit"), |
131 QKeySequence(self.tr("Ctrl+Q", "File|Quit")), |
131 QKeySequence(self.tr("Ctrl+Q", "File|Quit")), |
132 0, |
132 0, |
133 self, |
133 self, |
134 "sql_file_quit", |
134 "sql_file_quit", |
190 """ |
190 """ |
191 Private method to create the toolbars. |
191 Private method to create the toolbars. |
192 """ |
192 """ |
193 filetb = self.addToolBar(self.tr("File")) |
193 filetb = self.addToolBar(self.tr("File")) |
194 filetb.setObjectName("FileToolBar") |
194 filetb.setObjectName("FileToolBar") |
195 filetb.setIconSize(UI.Config.ToolBarIconSize) |
195 filetb.setIconSize(Config.ToolBarIconSize) |
196 filetb.addAction(self.addConnectionAct) |
196 filetb.addAction(self.addConnectionAct) |
197 filetb.addSeparator() |
197 filetb.addSeparator() |
198 filetb.addAction(self.exitAct) |
198 filetb.addAction(self.exitAct) |
199 |
199 |
200 def __about(self): |
200 def __about(self): |