Merge lp:~maikels/openlp/menufix into lp:openlp

Proposed by Maikel Stuivenberg
Status: Merged
Merged at revision: not available
Proposed branch: lp:~maikels/openlp/menufix
Merge into: lp:openlp
Diff against target: None lines
To merge this branch: bzr merge lp:~maikels/openlp/menufix
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Jon Tibble (community) Approve
Review via email: mp+12055@code.launchpad.net

This proposal supersedes a proposal from 2009-09-18.

To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

Looks good to me

review: Approve
Revision history for this message
Jon Tibble (meths) wrote : Posted in a previous version of this proposal

Looks fine here. Uncovered other issues in testing none the fault of this patch.

review: Approve
Revision history for this message
Jon Tibble (meths) :
review: Approve
Revision history for this message
Tim Bentley (trb143) wrote :

Approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/ui/mainwindow.py'
2--- openlp/core/ui/mainwindow.py 2009-09-12 18:27:17 +0000
3+++ openlp/core/ui/mainwindow.py 2009-09-18 09:03:04 +0000
4@@ -519,6 +519,14 @@
5 QtCore.SIGNAL(u'triggered()'), self.onOptionsSettingsItemClicked)
6 QtCore.QObject.connect(Receiver.get_receiver(),
7 QtCore.SIGNAL(u'update_global_theme'), self.defaultThemeChanged)
8+ QtCore.QObject.connect(self.FileNewItem,
9+ QtCore.SIGNAL(u'triggered()'), self.ServiceManagerContents.onNewService)
10+ QtCore.QObject.connect(self.FileOpenItem,
11+ QtCore.SIGNAL(u'triggered()'), self.ServiceManagerContents.onLoadService)
12+ QtCore.QObject.connect(self.FileSaveItem,
13+ QtCore.SIGNAL(u'triggered()'), self.ServiceManagerContents.onQuickSaveService)
14+ QtCore.QObject.connect(self.FileSaveAsItem,
15+ QtCore.SIGNAL(u'triggered()'), self.ServiceManagerContents.onSaveService)
16 #warning cyclic dependency
17 #RenderManager needs to call ThemeManager and
18 #ThemeManager needs to call RenderManager
19
20=== modified file 'openlp/core/ui/servicemanager.py'
21--- openlp/core/ui/servicemanager.py 2009-09-12 17:24:16 +0000
22+++ openlp/core/ui/servicemanager.py 2009-09-18 13:45:07 +0000
23@@ -100,6 +100,7 @@
24 self.parent = parent
25 self.serviceItems = []
26 self.serviceName = u''
27+ self.isNew = True
28 self.Layout = QtGui.QVBoxLayout(self)
29 self.Layout.setSpacing(0)
30 self.Layout.setMargin(0)
31@@ -319,6 +320,7 @@
32 self.ServiceManagerList.clear()
33 self.serviceItems = []
34 self.serviceName = u''
35+ self.isNew = True
36 self.parent.OosChanged(True, self.serviceName)
37
38 def onDeleteFromService(self):
39@@ -361,21 +363,28 @@
40 if serviceItem == itemcount and serviceItemCount == count:
41 self.ServiceManagerList.setCurrentItem(treewidgetitem1)
42
43- def onSaveService(self):
44+ def onSaveService(self, quick=False):
45 """
46 Save the current service in a zip file
47 This file contains
48 * An ood which is a pickle of the service items
49 * All image, presentation and video files needed to run the service.
50 """
51- filename = QtGui.QFileDialog.getSaveFileName(self,
52+ if not quick or self.isNew:
53+ filename = QtGui.QFileDialog.getSaveFileName(self,
54 u'Save Order of Service',self.config.get_last_dir() )
55- filename = unicode(filename)
56+ else:
57+ filename = self.config.get_last_dir()
58 if filename != u'':
59+ splittedFile = filename.split(u'.')
60+ if splittedFile[-1] != u'oos':
61+ filename = filename + u'.oos'
62+ filename = unicode(filename)
63+ self.isNew = False
64 self.config.set_last_dir(filename)
65 service = []
66 servicefile= filename + u'.ood'
67- zip = zipfile.ZipFile(unicode(filename) + u'.oos', 'w')
68+ zip = zipfile.ZipFile(unicode(filename), 'w')
69 for item in self.serviceItems:
70 service.append({u'serviceitem':item[u'data'].get_oos_repr()})
71 if item[u'data'].service_item_type == ServiceType.Image or \
72@@ -393,7 +402,12 @@
73 os.remove(servicefile)
74 except:
75 pass #if not present do not worry
76- self.parent.OosChanged(True, filename + u'.oos')
77+ name = filename.split(os.path.sep)
78+ self.serviceName = name[-1]
79+ self.parent.OosChanged(True, self.serviceName)
80+
81+ def onQuickSaveService(self):
82+ self.onSaveService(True)
83
84 def onLoadService(self):
85 """
86@@ -412,6 +426,7 @@
87 zip = zipfile.ZipFile(unicode(filename))
88 filexml = None
89 themename = None
90+
91 for file in zip.namelist():
92 names = file.split(os.path.sep)
93 file_to = os.path.join(self.servicePath,
94@@ -439,6 +454,7 @@
95 except:
96 log.error(u'Problem processing oos load %s', sys.exc_info()[0])
97 pass
98+ self.isNew = False
99 self.serviceName = name[len(name) - 1]
100 self.parent.OosChanged(True, self.serviceName)
101