Changes made to gtk functions during ocarina development

This commit is contained in:
bjschuma 2010-01-18 19:26:15 -05:00
parent 23c5ce7bc2
commit dda08f05b7
9 changed files with 65 additions and 10 deletions

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
</project-private>

View File

@ -1,7 +1,7 @@
# This class is used to load plugins
import sys
from bt.message import write
from bt.message import *
from bt.file import *
@ -46,7 +46,10 @@ class PluginLoader:
continue
# Load the module into our module array
write("Attempting to load "+mod, True)
self.loadmod(split[0], os.path.join(dir,mod))
try:
self.loadmod(split[0], os.path.join(dir,mod))
except:
error("Error loading "+mod)
# Call with a module name to import and path to plugin

View File

@ -26,7 +26,7 @@ def open():
# Called every time the plugin is stopped
def close():
# Run this to prevent disable from ever being disabled
manager.run("enable",("disable"))
manager.run("enable",["disable"])
pass

View File

@ -2,4 +2,4 @@ __author__="bjschuma"
__date__ ="$Jan 6, 2010 9:52:21 PM$"
__all__ = ["box", "button", "label", "list", "menu", "window"]
__all__ = ["box", "button", "label", "list", "menu", "tabs", "window"]

View File

@ -15,4 +15,8 @@ class Label(gtk.Label):
def change(self,text):
self.set_text(text)
self.set_text(text)
def rotate(self,angle):
self.set_angle(angle)

View File

@ -48,4 +48,12 @@ class List(gtk.ScrolledWindow):
if arg == None:
self.tree.connect(signal, func)
else:
self.tree.connect(signal, func, arg)
self.tree.connect(signal, func, arg)
def rules(self,hint):
self.tree.set_rules_hint(hint)
def count(self):
return len(self.list)

29
src/extra/guiGTK/tabs.py Normal file
View File

@ -0,0 +1,29 @@
#! /usr/bin/python
# To change this template, choose Tools | Templates
# and open the template in the editor.
__author__="bjschuma"
__date__ ="$Jan 16, 2010 12:37:41 PM$"
import gtk
class Tabs(gtk.Notebook):
def __init__(self):
gtk.Notebook.__init__(self)
self.show()
def tabpos(self,pos):
newpos = gtk.POS_LEFT
if pos=="right":
newpos = gtk.POS_RIGHT
elif pos=="top":
newpos = gtk.POS_TOP
elif pos=="bottom":
newpos = gtk.POS_BOTTOM
self.set_tab_pos(newpos)
def append(self,child,label=None):
self.append_page(child,label)

View File

@ -45,6 +45,10 @@ class Window(gtk.Window):
gtk.Window.hide(self)
def resize(self,size):
gtk.Window.resize(self,size[0],size[1])
class PluginWindow(Window):
@ -100,15 +104,17 @@ class PluginWindow(Window):
def enable(self,button,name):
list, path, plugin = self.getPlugin(self.disabled)
manager.run("enable",[plugin] )
self.disabled.remove(path)
self.enabled.insert([plugin])
if (plugin in manager.run("lsmod", "enabled")) == True:
self.disabled.remove(path)
self.enabled.insert([plugin])
def disable(self,button,name):
list, path, plugin = self.getPlugin(self.enabled)
manager.run("disable",[plugin])
self.enabled.remove(path)
self.disabled.insert([plugin])
if (plugin in manager.run("lsmod", "disabled")) == True:
self.enabled.remove(path)
self.disabled.insert([plugin])
def changeLabel(self,tree,name):

View File

@ -45,6 +45,7 @@ def loop():
tools = menu.Item("Tools",None,[plugins])
bar.append(tools)
#vbox.pack(tabs.Tabs())
#but = button.Button("button",test,None,"I'm a button!")
#vbox.pack(but)