Merge lp://staging/keryx/unstable into lp://staging/~jacseen/keryx/unstable

Proposed by mac9416
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/keryx/unstable
Merge into: lp://staging/~jacseen/keryx/unstable
Diff against target: 259 lines (+76/-30)
3 files modified
doc/keryx.conf (+1/-1)
lib/wxkeryx/main.py (+61/-27)
plugins/Debian.py (+14/-2)
To merge this branch: bzr merge lp://staging/keryx/unstable
Reviewer Review Type Date Requested Status
Jack N Approve
mac9416 (community) Needs Fixing
Review via email: mp+15066@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
mac9416 (mac9416) wrote :

Hey, jacseen, I made a few improvements to the Update Status feature. It now uses your __runRoot function. Hopefully this doesn't conflict with any of your recent changes.

Revision history for this message
mac9416 (mac9416) wrote :

It appears I broke one or two lines. I can fix them and resubmit if you want, or you can merge and fix them yourself. Your call. :)

review: Needs Fixing
Revision history for this message
Jack N (jacseen) wrote :

Not sure which lines you broke, but looks good and runs good. :D

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'doc/keryx.conf'
2--- doc/keryx.conf 2009-10-31 01:55:19 +0000
3+++ doc/keryx.conf 2009-11-25 03:06:10 +0000
4@@ -10,7 +10,7 @@
5 #### Examples ####
6
7 #LogDir=../logs
8-#LocaleDir=../locales
9+#LocaleDir=../locale
10 #PackagesDir=../packages
11 #PixmapsDir=../pixmaps
12 #PluginsDir=../plugins
13
14=== modified file 'lib/wxkeryx/main.py'
15--- lib/wxkeryx/main.py 2009-11-18 03:56:58 +0000
16+++ lib/wxkeryx/main.py 2009-11-25 03:06:10 +0000
17@@ -42,7 +42,7 @@
18 self.downloadButton = buttons.GenBitmapTextButton(self.buttonPanel, -1, wx.Bitmap(consts.icon_download), _("Download"))#, size=(95, 25))
19 self.updatesButton = buttons.GenBitmapTextButton(self.buttonPanel, -1, wx.Bitmap(consts.icon_updates), _("Get Updates"))#, size=(95, 25))
20 self.refreshButton = buttons.GenBitmapTextButton(self.buttonPanel, -1, wx.Bitmap(consts.icon_refresh), _("Refresh"))#, size=(95, 25))
21- self.updateStatusButton = buttons.GenBitmapTextButton(self.buttonPanel, -1, wx.Bitmap(consts.icon_refresh), _("Update Status"))#, size=(95, 25))
22+ #self.updateStatusButton = buttons.GenBitmapTextButton(self.buttonPanel, -1, wx.Bitmap(consts.icon_refresh), _("Update Status"))#, size=(95, 25))
23
24 self.notebook_il = wx.ImageList(16, 16)
25 self.notebook_il.Add(wx.Bitmap(consts.icon_project_details))
26@@ -171,7 +171,7 @@
27
28 self.Bind(wx.EVT_BUTTON, self.OnDownload, self.downloadButton)
29 self.Bind(wx.EVT_BUTTON, self.OnRefresh, self.refreshButton)
30- self.Bind(wx.EVT_BUTTON, self.OnUpdateStatus, self.updateStatusButton)
31+ #self.Bind(wx.EVT_BUTTON, self.OnUpdateStatus, self.updateStatusButton)
32 self.Bind(wx.EVT_BUTTON, self.OnUpdates, self.updatesButton)
33 self.Bind(wx.EVT_CLOSE, self.Closing)
34
35@@ -194,7 +194,7 @@
36 sizer_buttons.Add(self.downloadButton, 0, wx.ALL, 3)
37 sizer_buttons.Add(self.updatesButton, 0, wx.ALL, 3)
38 sizer_buttons.Add(self.refreshButton, 0, wx.ALL, 3)
39- sizer_buttons.Add(self.updateStatusButton, 0, wx.ALL, 3)
40+ #sizer_buttons.Add(self.updateStatusButton, 0, wx.ALL, 3)
41 #sizer_bottom.Add(sizer_buttons, 0, wx.ALIGN_CENTER_VERTICAL, 0)
42 self.buttonPanel.SetSizer(sizer_buttons)
43
44@@ -303,24 +303,22 @@
45 try:
46 selected = self.list.GetSelectedItem()
47 if selected: files = project.projects[len(project.projects) - 1].getDependencies(selected[1])
48- except: return
49+ except:
50+ return
51
52- # Generate filename list, max 6 entries
53- list = "\n\n"
54- for i in range(len(files)):
55- if i <= 5: list += files[i][0] + "\n"
56- else:
57- list += "..."
58- break
59+ # Generate filename list.
60+ list = ""
61+ for i in range(len(files)):
62+ list += files[i][0] + "\n"
63
64 # Confirm downloads
65- dlg = wx.MessageDialog(None, _("Do you wish to download the following") + " " + str(len(files)) + " " + _("files?") + list,
66- _("Confirm Downloads"), wx.YES_NO | wx.ICON_QUESTION)
67- result = dlg.ShowModal()
68+ dlg = ScrolledMessageDialog(None, _("Confirm Download"), _("Do you wish to download the following") + " " + str(len(files)) + " " + _("files?"), list)
69+ #dlg = wx.MessageDialog(None, _("Do you wish to download the following") + " " + str(len(files)) + " " + _("files?") + list, _("Confirm Downloads"), wx.YES_NO | wx.ICON_QUESTION)
70+ result = dlg.ShowModal() == wx.ID_OK
71 dlg.Destroy()
72
73 # User doesn't want to download them
74- if result == wx.ID_NO:
75+ if not result:
76 self.Refresh(project.projects[len(project.projects) -1].GetData())
77 #self.downloadedLists()
78 return
79@@ -371,7 +369,7 @@
80 else:
81 move = False
82 #wx.MessageBox(_("This feature is not implemented yet. Sorry."),_("Not Implemented"))
83- install = project.projects[len(project.projects) - 1].installCache(project.projects[len(project.projects) -1].dir, 'installcache', move=move)
84+ install = project.projects[len(project.projects) - 1].plugin.installCache(project.projects[len(project.projects) -1].dir, 'installcache', move=move)
85 elif result == wx.ID_NO:
86 wx.MessageBox(_("This feature is not implemented yet. Sorry."),_("Not Implemented"))
87 #install = project.projects[len(project.projects) - 1].installRepo()
88@@ -433,18 +431,22 @@
89 # dlg.Destroy()
90
91 def OnUpdateStatus(self, event):
92+ dlg = wx.MessageDialog(None, _("This will update the list of packages installed on your computer. Only run this on the computer you created this project on.\n\n" + \
93+ "Would you like to continue?"),
94+ _("Update Status"), wx.YES_NO | wx.ICON_QUESTION)
95+ result = dlg.ShowModal()
96+ dlg.Destroy()
97+ if not result:
98+ return
99 if not self.UpdateStatus():
100- print 'Could not update status file. Not on a Debian machine?'
101+ dlg = wx.MessageDialog(None, _("Status update failed. Try running Keryx as root (using 'sudo')."),
102+ _("Status Update Failed"), wx.ICON_ERROR)
103+ result = dlg.ShowModal()
104+ dlg.Destroy()
105 def UpdateStatus(self):
106- import shutil
107- project_dir = project.projects[len(project.projects) -1].GetData()[1]
108- lists_dir = os.path.join(project_dir, 'lists')
109- try:
110- shutil.copyfile('/var/lib/dpkg/status', os.path.join(lists_dir, 'status'))
111- shutil.copyfile('/var/lib/dpkg/status', os.path.join(lists_dir, 'status.bak'))
112- return True # Everything went well.
113- except IOError:
114- return False
115+ project_dir = project.projects[len(project.projects) -1].dir
116+ return project.projects[len(project.projects) - 1].plugin.updateStatus(project_dir)
117+
118
119 def OnRefresh(self, event):
120 self.Refresh(project.projects[len(project.projects) -1].GetData())
121@@ -489,4 +491,36 @@
122
123 self.SetStatusText(str(len(proj.packages.keys())) + " " + _("Packages"),0)
124
125-# end of class MainApp
126+# end of class MainApp
127+
128+# Begin mac9416's wonderful custom dialog!
129+
130+class ScrolledMessageDialog(wx.Dialog):
131+ def __init__(self, parent, title, caption, msg,
132+ pos=wx.DefaultPosition, size=(500,300),
133+ style=wx.DEFAULT_DIALOG_STYLE):
134+ wx.Dialog.__init__(self, parent, -1, title, pos, size, style)
135+ x, y = pos
136+ if x == -1 and y == -1:
137+ self.CenterOnScreen(wx.BOTH)
138+
139+ text1 = wx.StaticText(self, -1, caption)
140+ text2 = wx.TextCtrl(self, -1, msg, size=(500,300),
141+ style=wx.TE_MULTILINE | wx.TE_READONLY)
142+
143+ sizer = wx.BoxSizer(wx.VERTICAL)
144+
145+ btnsizer = wx.BoxSizer()
146+
147+ btn = wx.Button(self, wx.ID_OK, "Yes")
148+ btnsizer.Add(btn, 0, wx.ALL, 5)
149+ btnsizer.Add((5,-1), 0, wx.ALL, 5)
150+
151+ btn = wx.Button(self, wx.ID_CANCEL, "No")
152+ btn.SetDefault()
153+ btnsizer.Add(btn, 0, wx.ALL, 5)
154+
155+ sizer.Add(text1, 0, wx.EXPAND|wx.ALL, 5)
156+ sizer.Add(text2, 0, wx.EXPAND|wx.ALL, 5)
157+ sizer.Add(btnsizer, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
158+ self.SetSizerAndFit(sizer)
159
160=== added directory 'locale'
161=== added directory 'locale/ar'
162=== added directory 'locale/ar/LC_MESSAGES'
163=== added file 'locale/ar/LC_MESSAGES/keryx.mo'
164Binary files locale/ar/LC_MESSAGES/keryx.mo 1970-01-01 00:00:00 +0000 and locale/ar/LC_MESSAGES/keryx.mo 2009-11-25 03:06:10 +0000 differ
165=== added directory 'locale/cs'
166=== added directory 'locale/cs/LC_MESSAGES'
167=== added file 'locale/cs/LC_MESSAGES/keryx.mo'
168Binary files locale/cs/LC_MESSAGES/keryx.mo 1970-01-01 00:00:00 +0000 and locale/cs/LC_MESSAGES/keryx.mo 2009-11-25 03:06:10 +0000 differ
169=== added directory 'locale/en_CA'
170=== added directory 'locale/en_CA/LC_MESSAGES'
171=== added file 'locale/en_CA/LC_MESSAGES/keryx.mo'
172Binary files locale/en_CA/LC_MESSAGES/keryx.mo 1970-01-01 00:00:00 +0000 and locale/en_CA/LC_MESSAGES/keryx.mo 2009-11-25 03:06:10 +0000 differ
173=== added directory 'locale/es'
174=== added directory 'locale/es/LC_MESSAGES'
175=== added file 'locale/es/LC_MESSAGES/keryx.mo'
176Binary files locale/es/LC_MESSAGES/keryx.mo 1970-01-01 00:00:00 +0000 and locale/es/LC_MESSAGES/keryx.mo 2009-11-25 03:06:10 +0000 differ
177=== added directory 'locale/fr'
178=== added directory 'locale/fr/LC_MESSAGES'
179=== added file 'locale/fr/LC_MESSAGES/keryx.mo'
180Binary files locale/fr/LC_MESSAGES/keryx.mo 1970-01-01 00:00:00 +0000 and locale/fr/LC_MESSAGES/keryx.mo 2009-11-25 03:06:10 +0000 differ
181=== added directory 'locale/id'
182=== added directory 'locale/id/LC_MESSAGES'
183=== added file 'locale/id/LC_MESSAGES/keryx.mo'
184Binary files locale/id/LC_MESSAGES/keryx.mo 1970-01-01 00:00:00 +0000 and locale/id/LC_MESSAGES/keryx.mo 2009-11-25 03:06:10 +0000 differ
185=== added directory 'locale/ml'
186=== added directory 'locale/ml/LC_MESSAGES'
187=== added file 'locale/ml/LC_MESSAGES/keryx.mo'
188Binary files locale/ml/LC_MESSAGES/keryx.mo 1970-01-01 00:00:00 +0000 and locale/ml/LC_MESSAGES/keryx.mo 2009-11-25 03:06:10 +0000 differ
189=== added directory 'locale/nb'
190=== added directory 'locale/nb/LC_MESSAGES'
191=== added file 'locale/nb/LC_MESSAGES/keryx.mo'
192Binary files locale/nb/LC_MESSAGES/keryx.mo 1970-01-01 00:00:00 +0000 and locale/nb/LC_MESSAGES/keryx.mo 2009-11-25 03:06:10 +0000 differ
193=== added directory 'locale/pt'
194=== added directory 'locale/pt/LC_MESSAGES'
195=== added file 'locale/pt/LC_MESSAGES/keryx.mo'
196Binary files locale/pt/LC_MESSAGES/keryx.mo 1970-01-01 00:00:00 +0000 and locale/pt/LC_MESSAGES/keryx.mo 2009-11-25 03:06:10 +0000 differ
197=== added directory 'locale/pt_BR'
198=== added directory 'locale/pt_BR/LC_MESSAGES'
199=== added file 'locale/pt_BR/LC_MESSAGES/keryx.mo'
200Binary files locale/pt_BR/LC_MESSAGES/keryx.mo 1970-01-01 00:00:00 +0000 and locale/pt_BR/LC_MESSAGES/keryx.mo 2009-11-25 03:06:10 +0000 differ
201=== added directory 'locale/ru'
202=== added directory 'locale/ru/LC_MESSAGES'
203=== added file 'locale/ru/LC_MESSAGES/keryx.mo'
204Binary files locale/ru/LC_MESSAGES/keryx.mo 1970-01-01 00:00:00 +0000 and locale/ru/LC_MESSAGES/keryx.mo 2009-11-25 03:06:10 +0000 differ
205=== added directory 'locale/si'
206=== added directory 'locale/si/LC_MESSAGES'
207=== added file 'locale/si/LC_MESSAGES/keryx.mo'
208Binary files locale/si/LC_MESSAGES/keryx.mo 1970-01-01 00:00:00 +0000 and locale/si/LC_MESSAGES/keryx.mo 2009-11-25 03:06:10 +0000 differ
209=== added directory 'locale/sv'
210=== added directory 'locale/sv/LC_MESSAGES'
211=== added file 'locale/sv/LC_MESSAGES/keryx.mo'
212Binary files locale/sv/LC_MESSAGES/keryx.mo 1970-01-01 00:00:00 +0000 and locale/sv/LC_MESSAGES/keryx.mo 2009-11-25 03:06:10 +0000 differ
213=== added directory 'locale/th'
214=== added directory 'locale/th/LC_MESSAGES'
215=== added file 'locale/th/LC_MESSAGES/keryx.mo'
216Binary files locale/th/LC_MESSAGES/keryx.mo 1970-01-01 00:00:00 +0000 and locale/th/LC_MESSAGES/keryx.mo 2009-11-25 03:06:10 +0000 differ
217=== modified file 'plugins/Debian.py'
218--- plugins/Debian.py 2009-11-18 03:56:58 +0000
219+++ plugins/Debian.py 2009-11-25 03:06:10 +0000
220@@ -258,7 +258,7 @@
221 else:
222 transfer=''
223 print 'Launching installCache script as root'
224- run = __runRoot('sh', scriptpath+' '+projdir+' '+transfer)
225+ run = self.__runRoot('sh', scriptpath+' '+projdir+' '+transfer)
226 if run[0] != 0:
227 print run[1]
228 if run[0] == 64:
229@@ -281,6 +281,18 @@
230 """ Transfers all downloaded packages into a Repository and updates the OS about it, then tells it to install them. Uses script called as 'root'"""
231 return True
232
233+ def updateStatus(self, outdir, infile="/var/lib/dpkg/status"):
234+ """Update the project's status file (list of installed packages)"""
235+ import shutil
236+ lists_dir = os.path.join(outdir, 'lists')
237+ outfile = os.path.join(lists_dir, "status")
238+ outfilebak = os.path.join(lists_dir, "status.bak")
239+ # Back up the current status file.
240+ run = self.__runRoot('cp', '%s %s' % (outfile, outfilebak))
241+ # Copy in the new status file.
242+ run = self.__runRoot('cp', '%s %s' % (infile, outfile))
243+ return True # Everything went well.
244+
245 def __readPackages(self, infile, installed, packages, mainUrl=''):
246 # up-to-date, name, installed ver, latest ver, descrip, depends, filename, size(int)
247 current = ['','','','','','','','','','']
248@@ -450,7 +462,7 @@
249 root = a
250 break
251 if root == '': return 64, ''
252- exit = commands.getstatusoutput(root+' '+program+' '+filename)
253+ exit = commands.getstatusoutput('%s %s %s' % (root, program, filename))
254 return exit
255
256 class version_compare:
257
258=== modified file 'projects/jaunty-32-bit-default/lists/status' (properties changed: +x to -x)
259=== modified file 'projects/jaunty-32-bit-default/sources/sources.list' (properties changed: +x to -x)

Subscribers

People subscribed via source and target branches