[beryl-commits] r2213 - trunk/beryl-settings-2

quinn at server.beryl-project.org quinn at server.beryl-project.org
Mon Jan 1 13:11:29 CET 2007


Author: quinn
Date: 2007-01-01 12:11:29 +0000 (Mon, 01 Jan 2007)
New Revision: 2213

Modified:
   trunk/beryl-settings-2/main.py
Log:
basic edges support, needs some tweaking (mostly visual)


Modified: trunk/beryl-settings-2/main.py
===================================================================
--- trunk/beryl-settings-2/main.py	2007-01-01 11:17:37 UTC (rev 2212)
+++ trunk/beryl-settings-2/main.py	2007-01-01 12:11:29 UTC (rev 2213)
@@ -83,6 +83,7 @@
 		pl[11].props.height_request=400
 
 AllSettings=[]
+EdgeBoxes=[]
 
 GenStore=gtk.TreeStore(
 		gobject.TYPE_STRING,	#Entry Name
@@ -93,16 +94,55 @@
 		gobject.TYPE_STRING,	#plugin name
 		gobject.TYPE_STRING,	#setting name
 		)
+EdgeStore=gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING,gobject.TYPE_STRING,gobject.TYPE_BOOLEAN)
 
 def UpdateBindingsList(ShowHidden):
 	global GenStore
 	GenStore.clear()
+	global EdgeStore
+	EdgeStore.clear()
 	s=Ctx.Plugins
 	for p in range(0,len(s)):
 		if (s[p].Name=='_'):
 			nn=s[0]
 			s[0]=s[p]
 			s[p]=nn
+	connect=[
+			[4,8,16],
+			[1,0,2],
+			[32,64,128]
+			]
+	Iter=EdgeStore.append()
+	EdgeStore.set(Iter,0,"<small>None</small>",1,"",2,"",3,True)
+	if (len(EdgeBoxes)==3):
+		for row in range(0,3):
+			for col in range(0,3):
+				if (EdgeBoxes[row][col][0]):
+					EdgeBoxes[row][col][0].set_active_iter(Iter)
+	for p in s:
+		if (not (ShowHidden or Aps.Value.__contains__(p.Name) or p.Name=='_')):
+			continue
+		hasany=False
+		for q in p.Settings:
+			if q.Type == 'Binding' and q.Restrictions[3]:
+				hasany=True
+		if not hasany:
+			continue
+		Iter=EdgeStore.append()
+		EdgeStore.set(Iter,0,"<b><small>%s</small></b>"%p.ShortDesc,3,False)
+		for q in p.Settings:
+			if q.Type == 'Binding' and q.Restrictions[3]:
+				Iter=EdgeStore.append()
+				EdgeStore.set(Iter,0,"<small>%s</small>"%q.ShortDesc,1,p.Name,2,q.Name,3,True)
+				if len(EdgeBoxes)==3:
+					for row in range(0,3):
+						for col in range(0,3):
+							if (connect[row][col] != 0):
+								set=Ctx.EdgeOwner(connect[row][col])
+								if (set):
+									if (set.Name==q.Name and set.Plugin.Name==q.Plugin.Name):
+										EdgeBoxes[row][col][0].set_active_iter(Iter)
+							
 	for p in range(1,len(s)-1):
 		for q in range(p+1,len(s)):
 			if (s[p].ShortDesc>s[q].ShortDesc):
@@ -163,6 +203,44 @@
 	cont.add(genview)
 	return cont
 
+def MakeEdgeWidgets():
+	global EdgeStore
+	tab=gtk.Table()
+	al=gtk.VBox()
+	al.pack_start(tab,False,False)
+	desc=[
+			["Top Left Corner", "Top Edge", "Top Right Corner"],
+			["Left Edge","..","Right Edge"],
+			["Bottom Left Corner", "Bottom Edge", "Bottom Right Corner"]
+			]
+	global EdgeBoxes
+	EdgeBoxes=[]
+	connect=[
+			[4,8,16],
+			[1,0,2],
+			[32,64,128]
+			]
+	for h in range(0,3):
+		newbox=[]
+		for v in range(0,3):
+			if (h != 1 or v != 1):
+				align=gtk.Frame(desc[v][h])
+				box=gtk.ComboBox(EdgeStore)
+				cell=gtk.CellRendererText()
+				cell.props.wrap_width=140
+				cell.props.wrap_mode=gtk.WRAP_WORD
+				box.pack_start(cell,True)
+				box.add_attribute(cell,'markup',0)
+				box.add_attribute(cell,'sensitive',3)
+				align.add(box)
+				newbox=newbox+[(box,connect[v][h])]
+				tab.attach(align,h,h+1,v,v+1)
+			else:
+				newbox=newbox+[(None,connect[v][h])]
+		EdgeBoxes=EdgeBoxes+[newbox]
+	UpdateBindingsList(False)
+	return al
+
 def MakeAndConnect(wid,setting):
 	global AllSettings
 	resbut=gtk.Button()
@@ -327,8 +405,10 @@
 Edge=FooClass()
 NonCat=FooClass()
 KeyMouse=FooClass()
+EdSub=FooClass()
+EdSub.Name="__edges"
 Edge.Name="Edge Bindings"
-Edge.SubGroups=[]
+Edge.SubGroups=[EdSub]
 KeyMouse.Name="Keyboard and Mouse Bindings"
 BindSub=FooClass()
 BindSub.Name="__keymouse"
@@ -459,6 +539,12 @@
 			PlugHeaderLabel.props.xalign=0
 			PlugHeaderBox.pack_start(PlugHeaderLabel,True,True,0)
 			SubBox.pack_start(PlugHeaderBox,False,False)
+			if (Plug.Name=='__bindings'):
+				hideshowall=gtk.CheckButton("Show Inactive Plugins")
+				hideshowall.props.active=False
+				hideshowall.connect("clicked",hideshowclick)
+				SubBox.pack_start(hideshowall,False,False)
+
 			NoteBook=gtk.Notebook()
 			NoteBook.props.scrollable=True
 			SubBox.pack_start(NoteBook,True,True)
@@ -470,13 +556,13 @@
 				for j in c.SubGroups:
 					if (j.Name == '__keymouse'):
 						hasany=True
-						hideshowall=gtk.CheckButton("Show Inactive Plugins")
-						hideshowall.props.active=False
 						UpdateBindingsList(False)
-						hideshowall.connect("clicked",hideshowclick)
-						gvb.pack_start(hideshowall,False,False)
 						gvb.pack_start(MakeBindingsList(),True,True)
 						continue
+					if (j.Name == '__edges'):
+						hasany=True
+						gvb.pack_start(MakeEdgeWidgets(),True,True)
+						continue
 					ommm=gvb
 					exp=None
 					if (not j.Name == ''):




More information about the commits mailing list