60 |
60 |
61 for connection in connections: |
61 for connection in connections: |
62 url = QUrl(connection, QUrl.TolerantMode) |
62 url = QUrl(connection, QUrl.TolerantMode) |
63 if not url.isValid(): |
63 if not url.isValid(): |
64 self.__warnings.append( |
64 self.__warnings.append( |
65 self.trUtf8("Invalid URL: {0}").format(connection)) |
65 self.tr("Invalid URL: {0}").format(connection)) |
66 continue |
66 continue |
67 |
67 |
68 err = self.__browser.addConnection(url.scheme(), url.path(), |
68 err = self.__browser.addConnection(url.scheme(), url.path(), |
69 url.userName(), url.password(), |
69 url.userName(), url.password(), |
70 url.host(), url.port(-1)) |
70 url.host(), url.port(-1)) |
71 if err.type() != QSqlError.NoError: |
71 if err.type() != QSqlError.NoError: |
72 self.__warnings.append( |
72 self.__warnings.append( |
73 self.trUtf8("Unable to open connection: {0}".format( |
73 self.tr("Unable to open connection: {0}".format( |
74 err.text()))) |
74 err.text()))) |
75 |
75 |
76 QTimer.singleShot(0, self.__uiStartUp) |
76 QTimer.singleShot(0, self.__uiStartUp) |
77 |
77 |
78 def __uiStartUp(self): |
78 def __uiStartUp(self): |
95 """ |
95 """ |
96 # list of all actions |
96 # list of all actions |
97 self.__actions = [] |
97 self.__actions = [] |
98 |
98 |
99 self.addConnectionAct = E5Action( |
99 self.addConnectionAct = E5Action( |
100 self.trUtf8('Add Connection'), |
100 self.tr('Add Connection'), |
101 UI.PixmapCache.getIcon("databaseConnection.png"), |
101 UI.PixmapCache.getIcon("databaseConnection.png"), |
102 self.trUtf8('Add &Connection...'), |
102 self.tr('Add &Connection...'), |
103 0, 0, self, 'sql_file_add_connection') |
103 0, 0, self, 'sql_file_add_connection') |
104 self.addConnectionAct.setStatusTip(self.trUtf8( |
104 self.addConnectionAct.setStatusTip(self.tr( |
105 'Open a dialog to add a new database connection')) |
105 'Open a dialog to add a new database connection')) |
106 self.addConnectionAct.setWhatsThis(self.trUtf8( |
106 self.addConnectionAct.setWhatsThis(self.tr( |
107 """<b>Add Connection</b>""" |
107 """<b>Add Connection</b>""" |
108 """<p>This opens a dialog to add a new database""" |
108 """<p>This opens a dialog to add a new database""" |
109 """ connection.</p>""" |
109 """ connection.</p>""" |
110 )) |
110 )) |
111 self.addConnectionAct.triggered[()].connect( |
111 self.addConnectionAct.triggered.connect( |
112 self.__browser.addConnectionByDialog) |
112 self.__browser.addConnectionByDialog) |
113 self.__actions.append(self.addConnectionAct) |
113 self.__actions.append(self.addConnectionAct) |
114 |
114 |
115 self.exitAct = E5Action( |
115 self.exitAct = E5Action( |
116 self.trUtf8('Quit'), |
116 self.tr('Quit'), |
117 UI.PixmapCache.getIcon("exit.png"), |
117 UI.PixmapCache.getIcon("exit.png"), |
118 self.trUtf8('&Quit'), |
118 self.tr('&Quit'), |
119 QKeySequence(self.trUtf8("Ctrl+Q", "File|Quit")), |
119 QKeySequence(self.tr("Ctrl+Q", "File|Quit")), |
120 0, self, 'sql_file_quit') |
120 0, self, 'sql_file_quit') |
121 self.exitAct.setStatusTip(self.trUtf8('Quit the SQL browser')) |
121 self.exitAct.setStatusTip(self.tr('Quit the SQL browser')) |
122 self.exitAct.setWhatsThis(self.trUtf8( |
122 self.exitAct.setWhatsThis(self.tr( |
123 """<b>Quit</b>""" |
123 """<b>Quit</b>""" |
124 """<p>Quit the SQL browser.</p>""" |
124 """<p>Quit the SQL browser.</p>""" |
125 )) |
125 )) |
126 self.exitAct.triggered[()].connect(qApp.closeAllWindows) |
126 self.exitAct.triggered.connect(qApp.closeAllWindows) |
127 |
127 |
128 self.aboutAct = E5Action( |
128 self.aboutAct = E5Action( |
129 self.trUtf8('About'), |
129 self.tr('About'), |
130 self.trUtf8('&About'), |
130 self.tr('&About'), |
131 0, 0, self, 'sql_help_about') |
131 0, 0, self, 'sql_help_about') |
132 self.aboutAct.setStatusTip(self.trUtf8( |
132 self.aboutAct.setStatusTip(self.tr( |
133 'Display information about this software')) |
133 'Display information about this software')) |
134 self.aboutAct.setWhatsThis(self.trUtf8( |
134 self.aboutAct.setWhatsThis(self.tr( |
135 """<b>About</b>""" |
135 """<b>About</b>""" |
136 """<p>Display some information about this software.</p>""" |
136 """<p>Display some information about this software.</p>""" |
137 )) |
137 )) |
138 self.aboutAct.triggered[()].connect(self.__about) |
138 self.aboutAct.triggered.connect(self.__about) |
139 self.__actions.append(self.aboutAct) |
139 self.__actions.append(self.aboutAct) |
140 |
140 |
141 self.aboutQtAct = E5Action( |
141 self.aboutQtAct = E5Action( |
142 self.trUtf8('About Qt'), |
142 self.tr('About Qt'), |
143 self.trUtf8('About &Qt'), |
143 self.tr('About &Qt'), |
144 0, 0, self, 'sql_help_about_qt') |
144 0, 0, self, 'sql_help_about_qt') |
145 self.aboutQtAct.setStatusTip( |
145 self.aboutQtAct.setStatusTip( |
146 self.trUtf8('Display information about the Qt toolkit')) |
146 self.tr('Display information about the Qt toolkit')) |
147 self.aboutQtAct.setWhatsThis(self.trUtf8( |
147 self.aboutQtAct.setWhatsThis(self.tr( |
148 """<b>About Qt</b>""" |
148 """<b>About Qt</b>""" |
149 """<p>Display some information about the Qt toolkit.</p>""" |
149 """<p>Display some information about the Qt toolkit.</p>""" |
150 )) |
150 )) |
151 self.aboutQtAct.triggered[()].connect(self.__aboutQt) |
151 self.aboutQtAct.triggered.connect(self.__aboutQt) |
152 self.__actions.append(self.aboutQtAct) |
152 self.__actions.append(self.aboutQtAct) |
153 |
153 |
154 def __initMenus(self): |
154 def __initMenus(self): |
155 """ |
155 """ |
156 Private method to create the menus. |
156 Private method to create the menus. |
157 """ |
157 """ |
158 mb = self.menuBar() |
158 mb = self.menuBar() |
159 |
159 |
160 menu = mb.addMenu(self.trUtf8('&File')) |
160 menu = mb.addMenu(self.tr('&File')) |
161 menu.setTearOffEnabled(True) |
161 menu.setTearOffEnabled(True) |
162 menu.addAction(self.addConnectionAct) |
162 menu.addAction(self.addConnectionAct) |
163 menu.addSeparator() |
163 menu.addSeparator() |
164 menu.addAction(self.exitAct) |
164 menu.addAction(self.exitAct) |
165 |
165 |
166 mb.addSeparator() |
166 mb.addSeparator() |
167 |
167 |
168 menu = mb.addMenu(self.trUtf8('&Help')) |
168 menu = mb.addMenu(self.tr('&Help')) |
169 menu.setTearOffEnabled(True) |
169 menu.setTearOffEnabled(True) |
170 menu.addAction(self.aboutAct) |
170 menu.addAction(self.aboutAct) |
171 menu.addAction(self.aboutQtAct) |
171 menu.addAction(self.aboutQtAct) |
172 |
172 |
173 def __initToolbars(self): |
173 def __initToolbars(self): |
174 """ |
174 """ |
175 Private method to create the toolbars. |
175 Private method to create the toolbars. |
176 """ |
176 """ |
177 filetb = self.addToolBar(self.trUtf8("File")) |
177 filetb = self.addToolBar(self.tr("File")) |
178 filetb.setObjectName("FileToolBar") |
178 filetb.setObjectName("FileToolBar") |
179 filetb.setIconSize(UI.Config.ToolBarIconSize) |
179 filetb.setIconSize(UI.Config.ToolBarIconSize) |
180 filetb.addAction(self.addConnectionAct) |
180 filetb.addAction(self.addConnectionAct) |
181 filetb.addSeparator() |
181 filetb.addSeparator() |
182 filetb.addAction(self.exitAct) |
182 filetb.addAction(self.exitAct) |