Helpviewer/OfflineStorage/WebDatabasesDialog.py

Fri, 11 Mar 2011 16:51:57 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 11 Mar 2011 16:51:57 +0100
changeset 945
8cd4d08fa9f6
parent 791
9ec2ac20e54e
child 1131
7781e396c903
permissions
-rw-r--r--

Made code mostly PEP 8 compliant (except all whitespace and line length).

353
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
791
9ec2ac20e54e Updated copyright notice.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 353
diff changeset
3 # Copyright (c) 2010 - 2011 Detlev Offenbach <detlev@die-offenbachs.de>
353
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to show all web databases.
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 from PyQt4.QtCore import Qt
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 from PyQt4.QtGui import QDialog, QFontMetrics
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from E5Gui.E5TreeSortFilterProxyModel import E5TreeSortFilterProxyModel
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 from .Ui_WebDatabasesDialog import Ui_WebDatabasesDialog
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 from .WebDatabasesModel import WebDatabasesModel
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 import UI.PixmapCache
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
21
353
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 class WebDatabasesDialog(QDialog, Ui_WebDatabasesDialog):
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 """
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 Class implementing a dialog to show all web databases.
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
26 def __init__(self, parent=None):
353
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 """
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 Constructor
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 @param parent reference to the parent widget (QWidget)
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 """
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 QDialog.__init__(self, parent)
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 self.setupUi(self)
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 self.clearButton.setIcon(UI.PixmapCache.getIcon("clearLeft.png"))
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.removeButton.clicked.connect(self.databasesTree.removeSelected)
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.removeAllButton.clicked.connect(self.databasesTree.removeAll)
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 model = WebDatabasesModel(self)
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 self.__proxyModel = E5TreeSortFilterProxyModel(self)
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.__proxyModel.setFilterKeyColumn(-1)
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 self.__proxyModel.setSourceModel(model)
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 self.searchEdit.textChanged.connect(self.__proxyModel.setFilterFixedString)
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 self.databasesTree.setModel(self.__proxyModel)
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 fm = QFontMetrics(self.font())
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 header = fm.width("m") * 30
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 self.databasesTree.header().resizeSection(0, header)
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 self.databasesTree.model().sort(
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
52 self.databasesTree.header().sortIndicatorSection(),
353
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 Qt.AscendingOrder)
c548890dff9b Added dialog to manage Web SQL Databases to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 self.databasesTree.expandAll()

eric ide

mercurial