public inbox for gentoo-soc@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-soc] ventoo patches
@ 2010-03-31  4:09 Christopher Harvey
  0 siblings, 0 replies; only message in thread
From: Christopher Harvey @ 2010-03-31  4:09 UTC (permalink / raw
  To: gentoo-soc

[-- Attachment #1: Type: text/plain, Size: 1166 bytes --]

I noticed on the google application form we had to use source control tools 
and create a patch.

Here is my patch. 
this patch applies to the submitted code here:
http://google-summer-of-code-2007-
gentoo.googlecode.com/files/LuisFrancisco_Araujo.tar.gz

This patch prevents the line
import from data *
from polluting the global namespace with variables like 'name', 'logo' and 
'icon'. Now the variables are referred to as data.name, data.logo and 
data.icon. Those changes have been made as well. I don't like installing 
development code on my system outside of package management, so I also added a 
command line argument to look for an optional config file that isn't 
/etc/ventoo.conf. This patch, along with local ventoo config file changes and 
other hardcoded file path changes let me start ventoo successfully from a 
local directory. There were still some other "file not found errors" when 
trying to use specific modules, however the purpose of this post is simply to 
comply with the application procedure and prove that I understand the basic 
tools for working with this project, not fix the whole thing to run perfectly 
without a system install. 

[-- Attachment #2: ventoo.diff --]
[-- Type: text/x-patch, Size: 5457 bytes --]

--- src/window.py	2007-08-25 14:33:06.000000000 -0400
+++ /home/christopher/Downloads/ventoo-0.3/src/window.py	2010-03-30 23:56:04.000000000 -0400
@@ -24,16 +24,17 @@
 import controller, widget
 import re, os
 import os.path as osp
-from data import *
+import data
 from utils import VentooError
 import utils
+import sys
 
 
 class Window(object):
 
 	def __init__(self):
 		self.window = gtk.Window()
-		self.window.set_title(name)
+		self.window.set_title(data.name)
 		self.window.connect('delete-event', utils.close_main)
 		# Main VBox.
 		vbox = gtk.VBox()
@@ -105,7 +106,7 @@
 		self.hpaned.set_position(170)
 		# Build the window.
 		ventooinfo = gtk.Label()
-		ventooinfo.set_markup(ventoo_header)
+		ventooinfo.set_markup(data.ventoo_header)
 		headerbox = gtk.HBox()
 		headerbox.pack_start(ventooinfo, False)
 		headerbox.pack_start(self.newtreelabel, False)
@@ -130,8 +131,8 @@
 
 	def initialize(self):
 		"""Complete the ventoo_module structure."""
-		ventoo_module['Executable'] = ventoo_executable
-		ventoo_module['ExecutablePath'] = ventoo_executable
+		data.ventoo_module['Executable'] = data.ventoo_executable
+		data.ventoo_module['ExecutablePath'] = data.ventoo_executable
 
 	def update_statusbar(self, context, msg):
 		if self.statbarcontextid:
@@ -187,7 +188,7 @@
 
 	def category(self):
 		self.treestore = gtk.TreeStore(gtk.gdk.Pixbuf, str)
-		pixbuf = gtk.gdk.pixbuf_new_from_file(tree_icon)
+		pixbuf = gtk.gdk.pixbuf_new_from_file(data.tree_icon)
 		# Create the category and sub-category hierarchy.
 		def walk_iters(data, piter):
 			(e, xs) = data
@@ -198,7 +199,7 @@
 				make_iters(xs, rpiter)
 		def make_iters(xs, piter):
 			for a in xs: walk_iters(a, piter)
-		make_iters(categories, None)
+		make_iters(data.categories, None)
 		# Create the TreeView using treestore.
 	        self.category_tree = gtk.TreeView(self.treestore)
 		# Enable scrolling.
@@ -385,13 +386,13 @@
 		self.web_browser()
 		hbox = gtk.HBox()
 		image = gtk.Image()
-		image.set_from_file(icon)
+		image.set_from_file(data.icon)
 		self.infoiconbutton = gtk.Button()
 		self.infoiconbutton.set_image(image)
 		buttonbox = gtk.VBox()
 		buttonbox.pack_start(self.infoiconbutton, False, padding=5)
-		self.name_label = gtk.Label(name)
-		self.version_label = gtk.Label(ventoo_version)
+		self.name_label = gtk.Label(data.name)
+		self.version_label = gtk.Label(data.ventoo_version)
 		buttonbox.pack_start(self.name_label, False)
 		buttonbox.pack_start(self.version_label, False)
 		hbox.pack_start(buttonbox, False, padding=5)
@@ -412,7 +413,7 @@
 		hbox.pack_start(gtk.VSeparator(), False, padding=5)
 		hbox.pack_start(webbox, False, padding=5)
 		# Connect button handler.
-		self.connect_info_button(ventoo_module)
+		self.connect_info_button(data.ventoo_module)
 		# Add the label into the vertical box.
 		hbox.set_border_width(5)
 		self.widgetinfoframe.add(hbox)
@@ -420,7 +421,7 @@
 	def web_browser(self):
 		self.web = gtkmozembed.MozEmbed()
 		self.webframe = gtk.Frame()
-		self.web.load_url(ventoo_doc)
+		self.web.load_url(data.ventoo_doc)
 		self.webframe.add(self.web)
 
 	def update_module_info(self, treeview, isfavorite=False):
@@ -478,7 +479,7 @@
 			# Clear menu and module information.
 			self.liststore.clear()
 			self.web.load_url(ventoo_doc)
-			self.update_module_button_info(ventoo_module)
+			self.update_module_button_info(data.ventoo_module)
 		else:
 			self.dirchooser.destroy()
 
@@ -490,7 +491,7 @@
 		self.searchlist = list()
 		# Create the search button.
 		image = gtk.Image()
-		image.set_from_file(search_icon)
+		image.set_from_file(data.search_icon)
 		self.searchbutton = gtk.Button()
 		self.searchbutton.set_image(image)
 		self.searchbutton.connect('clicked', self.search_data)
@@ -576,17 +577,18 @@
 	def init_preferences(self):
 		"""Use the ventoo API to initialize the configuration file variables."""
 		# Get the controller.
-		self.configuration = controller.TxtController(config_default)
+		print "~~~~~~~Passed " + data.config_default
+		self.configuration = controller.TxtController(data.config_default)
 		self.configuration.read()
 		# Initialize the ventoo preferences variables.
 		self.init_prefvar(self.configuration.variables, 'root')
 		self.init_prefvar(self.configuration.variables, 'browser')
 		# Respectives structures.
-		root_struct = (self.configuration, 'root', name+' Root',
+		root_struct = (self.configuration, 'root', data.name +' Root',
 			       'This is the main ventoo module tree')
 		self.cp_root = widget.EntryFrame(*root_struct)
-		browser_struct = (self.configuration, 'browser', name+' Web Browser',
-				  'This is the application to open web links on '+name)
+		browser_struct = (self.configuration, 'browser', data.name +' Web Browser',
+				  'This is the application to open web links on '+ data.name)
 		self.cp_browser = widget.EntryFrame(*browser_struct)
 
 	def preferences_panel(self, t=None):
@@ -637,7 +639,7 @@
 			raise VentooError(val + ' path does not exist.\n' +
 					  'Please check the <b>' + field + '</b> ' +
 					  'variable on the configuration file:\n' +
-					  config_default)
+					  data.config_default)
 
 	def about(self, t=None):
 		"""Information about this application."""
@@ -697,6 +699,9 @@
 	utils.run_command(ventoo_executable)
 
 def main():
+	#set another ventoo config file...maybe the user prefers a different brower.
+	if len(sys.argv) == 2:
+		data.config_default = sys.argv[1];
 	Window()
 	gtk.main()
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-03-31  4:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-31  4:09 [gentoo-soc] ventoo patches Christopher Harvey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox