eric7/SqlBrowser/SqlBrowser.py

branch
eric7
changeset 8356
68ec9c3d4de5
parent 8318
962bce857696
child 8358
144a6b854f70
equal deleted inserted replaced
8355:8a7677a63c8d 8356:68ec9c3d4de5
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 E5Gui.E5Action import E5Action 14 from E5Gui.EricAction import EricAction
15 from E5Gui import E5MessageBox 15 from E5Gui import EricMessageBox
16 from E5Gui.E5MainWindow import E5MainWindow 16 from E5Gui.EricMainWindow import EricMainWindow
17 from E5Gui.E5Application import e5App 17 from E5Gui.EricApplication import ericApp
18 18
19 import UI.PixmapCache 19 import UI.PixmapCache
20 import UI.Config 20 import UI.Config
21 21
22 import Preferences 22 import Preferences
23 23
24 24
25 class SqlBrowser(E5MainWindow): 25 class SqlBrowser(EricMainWindow):
26 """ 26 """
27 Class implementing the SQL Browser main window. 27 Class implementing the SQL Browser main window.
28 """ 28 """
29 def __init__(self, connections=None, parent=None): 29 def __init__(self, connections=None, parent=None):
30 """ 30 """
81 """ 81 """
82 Private slot to do some actions after the UI has started and the main 82 Private slot to do some actions after the UI has started and the main
83 loop is up. 83 loop is up.
84 """ 84 """
85 for warning in self.__warnings: 85 for warning in self.__warnings:
86 E5MessageBox.warning( 86 EricMessageBox.warning(
87 self, 87 self,
88 self.tr("SQL Browser startup problem"), 88 self.tr("SQL Browser startup problem"),
89 warning) 89 warning)
90 90
91 if len(QSqlDatabase.connectionNames()) == 0: 91 if len(QSqlDatabase.connectionNames()) == 0:
96 Private method to define the user interface actions. 96 Private method to define the user interface actions.
97 """ 97 """
98 # list of all actions 98 # list of all actions
99 self.__actions = [] 99 self.__actions = []
100 100
101 self.addConnectionAct = E5Action( 101 self.addConnectionAct = EricAction(
102 self.tr('Add Connection'), 102 self.tr('Add Connection'),
103 UI.PixmapCache.getIcon("databaseConnection"), 103 UI.PixmapCache.getIcon("databaseConnection"),
104 self.tr('Add &Connection...'), 104 self.tr('Add &Connection...'),
105 0, 0, self, 'sql_file_add_connection') 105 0, 0, self, 'sql_file_add_connection')
106 self.addConnectionAct.setStatusTip(self.tr( 106 self.addConnectionAct.setStatusTip(self.tr(
112 )) 112 ))
113 self.addConnectionAct.triggered.connect( 113 self.addConnectionAct.triggered.connect(
114 self.__browser.addConnectionByDialog) 114 self.__browser.addConnectionByDialog)
115 self.__actions.append(self.addConnectionAct) 115 self.__actions.append(self.addConnectionAct)
116 116
117 self.exitAct = E5Action( 117 self.exitAct = EricAction(
118 self.tr('Quit'), 118 self.tr('Quit'),
119 UI.PixmapCache.getIcon("exit"), 119 UI.PixmapCache.getIcon("exit"),
120 self.tr('&Quit'), 120 self.tr('&Quit'),
121 QKeySequence(self.tr("Ctrl+Q", "File|Quit")), 121 QKeySequence(self.tr("Ctrl+Q", "File|Quit")),
122 0, self, 'sql_file_quit') 122 0, self, 'sql_file_quit')
123 self.exitAct.setStatusTip(self.tr('Quit the SQL browser')) 123 self.exitAct.setStatusTip(self.tr('Quit the SQL browser'))
124 self.exitAct.setWhatsThis(self.tr( 124 self.exitAct.setWhatsThis(self.tr(
125 """<b>Quit</b>""" 125 """<b>Quit</b>"""
126 """<p>Quit the SQL browser.</p>""" 126 """<p>Quit the SQL browser.</p>"""
127 )) 127 ))
128 self.exitAct.triggered.connect(e5App().closeAllWindows) 128 self.exitAct.triggered.connect(ericApp().closeAllWindows)
129 129
130 self.aboutAct = E5Action( 130 self.aboutAct = EricAction(
131 self.tr('About'), 131 self.tr('About'),
132 self.tr('&About'), 132 self.tr('&About'),
133 0, 0, self, 'sql_help_about') 133 0, 0, self, 'sql_help_about')
134 self.aboutAct.setStatusTip(self.tr( 134 self.aboutAct.setStatusTip(self.tr(
135 'Display information about this software')) 135 'Display information about this software'))
138 """<p>Display some information about this software.</p>""" 138 """<p>Display some information about this software.</p>"""
139 )) 139 ))
140 self.aboutAct.triggered.connect(self.__about) 140 self.aboutAct.triggered.connect(self.__about)
141 self.__actions.append(self.aboutAct) 141 self.__actions.append(self.aboutAct)
142 142
143 self.aboutQtAct = E5Action( 143 self.aboutQtAct = EricAction(
144 self.tr('About Qt'), 144 self.tr('About Qt'),
145 self.tr('About &Qt'), 145 self.tr('About &Qt'),
146 0, 0, self, 'sql_help_about_qt') 146 0, 0, self, 'sql_help_about_qt')
147 self.aboutQtAct.setStatusTip( 147 self.aboutQtAct.setStatusTip(
148 self.tr('Display information about the Qt toolkit')) 148 self.tr('Display information about the Qt toolkit'))
185 185
186 def __about(self): 186 def __about(self):
187 """ 187 """
188 Private slot to show the about information. 188 Private slot to show the about information.
189 """ 189 """
190 E5MessageBox.about( 190 EricMessageBox.about(
191 self, 191 self,
192 self.tr("SQL Browser"), 192 self.tr("SQL Browser"),
193 self.tr( 193 self.tr(
194 """<h3>About SQL Browser</h3>""" 194 """<h3>About SQL Browser</h3>"""
195 """<p>The SQL browser window is a little tool to examine """ 195 """<p>The SQL browser window is a little tool to examine """
200 200
201 def __aboutQt(self): 201 def __aboutQt(self):
202 """ 202 """
203 Private slot to show info about Qt. 203 Private slot to show info about Qt.
204 """ 204 """
205 E5MessageBox.aboutQt(self, self.tr("SQL Browser")) 205 EricMessageBox.aboutQt(self, self.tr("SQL Browser"))

eric ide

mercurial