From 9a7c2b42a759b5eadb7061b6830ec191927d15b8 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Tue, 2 Dec 2008 13:33:52 +0000 Subject: [PATCH] Added some flesh to the Windows Registry class. bzr-revno: 164 --- openlp.org 2.0.e4p | 3 +- openlp/core/utils/__init__.py | 4 +- openlp/core/utils/confighelper.py | 14 ++ openlp/core/utils/registry.py | 51 ++++++ openlp/core/utils/winregistry.py | 75 ++++++++- openlp/plugins/biblemanager/bibleplugin.py | 8 +- resources/forms/about.ui | 175 +++------------------ 7 files changed, 168 insertions(+), 162 deletions(-) diff --git a/openlp.org 2.0.e4p b/openlp.org 2.0.e4p index 51a526e9b..b6d3cc1c8 100644 --- a/openlp.org 2.0.e4p +++ b/openlp.org 2.0.e4p @@ -1,7 +1,7 @@ - + Python @@ -82,6 +82,7 @@ openlp/core/utils/winregistry.py openlp/core/utils/registry.py openlp/core/utils/linregistry.py + setup.py
resources/forms/bibleimport.ui
diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 1fb9474c7..678c6e083 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -17,8 +17,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA """ from registry import Registry -from linregistry import LinRegistry -from winregistry import WinRegistry from confighelper import ConfigHelper -__all__ = ['Registry', 'LinRegistry', 'WinRegistry', 'ConfigHelper'] +__all__ = ['Registry', 'ConfigHelper'] diff --git a/openlp/core/utils/confighelper.py b/openlp/core/utils/confighelper.py index b3ce011b0..e167837aa 100644 --- a/openlp/core/utils/confighelper.py +++ b/openlp/core/utils/confighelper.py @@ -56,3 +56,17 @@ class ConfigHelper(object): def getBiblePath(): return os.path.join(ConfigHelper.getConfigPath(), "Data","Bibles") + @staticmethod + def getRegistry(): + """ + This static method loads the appropriate registry class based on the + current operating system, and returns an instantiation of that class. + """ + reg = None + if os.name == 'nt': + from winregistry import WinRegistry + reg = WinRegistry() + else: + from linregistry import LinRegistry + reg = LinRegistry() + return reg diff --git a/openlp/core/utils/registry.py b/openlp/core/utils/registry.py index b520b05be..6db496908 100644 --- a/openlp/core/utils/registry.py +++ b/openlp/core/utils/registry.py @@ -23,4 +23,55 @@ class Registry(object): The Registry class is a generic class for the accessing configurations. """ def __init__(self): + """ + Initialise the Registry object. Override this to add custom initialisation. + """ + pass + + def has_value(self, section, key): + """ + Check if a value exists. + """ + pass + + def create_value(self, section, key): + """ + Create a new value in the registry. + """ + pass + + def get_value(self, section, key): + """ + Get a single value from the registry. + """ + pass + + def set_value(self, section, key, value): + """ + Set a single value in the registry. + """ + pass + + def delete_value(self, section, key): + """ + Delete a single value from the registry. + """ + pass + + def has_section(self, section): + """ + Check if a section exists. + """ + return False + + def create_section(self, section): + """ + Create a new section in the registry. + """ + pass + + def delete_section(self, section): + """ + Delete a section (including all values). + """ pass diff --git a/openlp/core/utils/winregistry.py b/openlp/core/utils/winregistry.py index 4b7a7f822..340684cc3 100644 --- a/openlp/core/utils/winregistry.py +++ b/openlp/core/utils/winregistry.py @@ -17,6 +17,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ +import _winreg +import types from openlp.core.utils import Registry @@ -24,6 +26,75 @@ class WinRegistry(Registry): """ The WinRegistry class is a high-level wrapper class for the Windows registry functions in Python. + + Notes: """ - def __init__(self): - import _winreg + def __init__(self, base_key): + """ + Connection to the Windows registry, and save the handle. + """ + self.reg_handle = _winreg.CreateConnection(None, _winreg.HKEY_CURRENT_USER) + self.base_key = base_key + if not self.base_key.endswith('\\'): + self.base_key = self.base_key + '\\' + + def has_value(self, section, key): + """ + Check if a key exists. + """ + return False + + def create_value(self, section, key): + """ + Create a new key in the Windows registry. + """ + pass + + def get_value(self, section, key): + """ + Get a single value from the Windows registry. + """ + key_handle = _winreg.OpenKey(self.reg_handle, self.base_key + section) + value = _winreg.QueryValueEx(key_handle, key)[0] + _winreg.CloseKey(key_handle) + return value + + def set_value(self, section, key, value): + """ + Set a single value in the Windows registry. + """ + reg_type = _winreg.REG_BINARY + if type(value) is types.String: + reg_type = _winreg.REG_SZ + elif type(value) is types.Integer: + reg_type = _winreg.REG_DWORD + key_handle = _winreg.OpenKey(self.reg_handle, self.base_key + section) + _winreg.SetValueEx(key_handle, key, 0, reg_type, value) + _winreg.CloseKey(key_handle) + + def delete_value(self, section, key): + """ + Delete a value from the Windows registry. + """ + key_handle = _winreg.OpenKey(self.reg_handle, self.base_key + section) + _winreg.DeleteValue(key_handle, key) + _winreg.CloseKey(key_handle) + + def has_section(self, section): + """ + Check if a section exists. + """ + return False + + def create_section(self, section): + """ + Create a new section in the Windows registry. + """ + try: + _winreg.CreateKey(self.reg_handle, self.base_key + section) + return True + except EnvironmentError: + return False + + def delete_section(self, section): + pass diff --git a/openlp/plugins/biblemanager/bibleplugin.py b/openlp/plugins/biblemanager/bibleplugin.py index 9c44dbfc4..a3cdc2652 100644 --- a/openlp/plugins/biblemanager/bibleplugin.py +++ b/openlp/plugins/biblemanager/bibleplugin.py @@ -31,7 +31,7 @@ class BiblePlugin(Plugin): Plugin.__init__(self, 'Bible', '1.9.0') self.Weight = -9 #Register the bible Manager - self.biblemanager = BibleManager() + #self.biblemanager = BibleManager() def getMediaManagerItem(self): @@ -87,7 +87,7 @@ class BiblePlugin(Plugin): self.listView = QtGui.QListView(self.groupBox) self.listView.setGeometry(QtCore.QRect(10, 180, 256, 192)) self.listView.setObjectName("listView") - + # self.groupBox = QtGui.QGroupBox(self.MediaManagerItem) # self.groupBox.setGeometry(QtCore.QRect(10, 10, 251, 341)) # self.groupBox.setObjectName("groupBox") @@ -112,8 +112,8 @@ class BiblePlugin(Plugin): return self.MediaManagerItem def onBibleNewClick(self): - self.bibleimportform = BibleImportForm(self.biblemanager) - self.bibleimportform.show() + #self.bibleimportform = BibleImportForm(self.biblemanager) + #self.bibleimportform.show() pass def onBiblePreviewClick(self): diff --git a/resources/forms/about.ui b/resources/forms/about.ui index 702a04a03..da35982d5 100644 --- a/resources/forms/about.ui +++ b/resources/forms/about.ui @@ -133,160 +133,32 @@ Credits + + 0 + + + 8 + - - - - 0 - 0 - - - - - 10 - 10 - - - - - 372 - 391 - - - - true - - - Qt::ScrollBarAlwaysOn - - - false - - - Qt::AlignCenter - - - - - 6 - 0 - 400 - 760 - - - - - 0 - 0 - - - - - 400 - 760 - - - - - 0 - - - 8 - - - - - - 0 - 0 - - - - - 369 - 391 - - - - - 10 - 10 - - - - - 369 - 760 - - - - - 12 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:12pt; font-weight:400; font-style:normal;"> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;"><span style=" font-size:10pt; font-weight:600; text-decoration: underline;">openlp.org 2.0.0</span></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">Copyright © 2004-2008 openlp.org Foundation</p> -<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"><span style=" font-weight:600;">- Lead Developer -</span></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">Raoul Snyman</p> -<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"><span style=" font-weight:600;">- Original Development -</span></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">Tim Ebenezer</p> -<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"><span style=" font-weight:600;">- Additional Development -</span></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">Derek Scotney</p> -<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"><span style=" font-weight:600;">- Testing -</span></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">Jonathan Corwin</p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">Scott Hileard</p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">Ken Marshall</p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">Duane Pearce</p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">Andrew (thealok)</p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">Les Norbo</p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">Many others in the community</p> -<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"><span style=" font-weight:600;">- Documentation -</span></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">Raoul Snyman</p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">Hannah Snyman</p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">David Bunce</p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">Seth Mayo</p> -<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"><span style=" font-weight:600;">- Components Used -</span></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">JCL &amp; JVCL - Project Jedi</p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"><span style=" font-style:italic;">Mozilla Public License</span></p> -<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">Toolbar2000 - JR Software</p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"><span style=" font-style:italic;">GNU General Public License</span></p> -<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">TBX - Alex Denisov</p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"><span style=" font-style:italic;">Custom Freeware License</span></p> -<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">Graphics 32 - Alex Denisov</p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"><span style=" font-style:italic;">Mozilla Public License</span></p> -<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">Saturn Component Pack - Saturn Laboratories</p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"><span style=" font-style:italic;">Mozilla Public License</span></p> -<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"><span style=" font-weight:600;">- Final Credit -</span></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"><span style=" font-style:italic;">"For God so loved the world that He gave</span></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"><span style=" font-style:italic;">His one and only Son, so that whoever</span></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"><span style=" font-style:italic;">believes in Him will not perish but inherit</span></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"><span style=" font-style:italic;">eternal life." -- John 3:16</span></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">And last but not least, final credit goes to</p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">God our Father, for sending His Son to die</p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">on the cross, setting us free from sin. We</p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">bring this software to you for free because</p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;">He has set us free.</p></body></html> - - - - - +</style></head><body style=" font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Project Lead</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Raoul Snyman</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Developers</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Tim Bentley</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Jonathan Corwin</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Raoul Snyman</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Martin Thompson</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Carsten Tingaard</p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + @@ -340,7 +212,6 @@ p, li { white-space: pre-wrap; } - CreditsScrollArea ContributeButton