Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugardummy.py
blob: 5ebea5ece6486b369e5b8238ddbdd4c2b463e78c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95

import gtk
import os.path

# Dummy class for Sugar
class activity:

	# Dummy class for Activity
	class Activity:
		_canvas = None
		_toobox = None

		def __init__(self, handle):
			self.window  = gtk.Window()
			self.window.set_title("Roots")
			self.window.connect("destroy", self.on_close)
			self.metadata = {}

		def set_canvas(self, canvas):
			self._canvas = canvas
		
		def show_all(self):
			vbox = gtk.VBox(False)
			vbox.pack_start(self._toolbox, True, True, 0)
			vbox.pack_start(self._canvas, True, True, 0)
			self.window.add(vbox)
			self.window.show_all()
			if os.path.isfile("../tmp/sugar_dummy_journal.txt"):
				self.read_file("../tmp/sugar_dummy_journal.txt")
			
		def create_pango_context(self):
			return gtk.Widget.create_pango_context(self.window)
	
		def set_toolbox(self, toolbox):
			self._toolbox = toolbox
			
		def read_file(self, file_path):
			pass
			
		def write_file(self, file_path):
			pass
			
		def on_close(self, event):
			gtk.main_quit()
			self.write_file("../tmp/sugar_dummy_journal.txt")
			
	
	# Dummy class for Toolbox
	class ActivityToolbox(gtk.Toolbar):
	
		def __init__(self, window):
			gtk.Toolbar.__init__(self)
			self.toolbars = {}
			
		def show(self):
			for t in self.toolbars.itervalues():
				for i in t.myitems:
					action = gtk.Action(i.id, i.tooltip, i.tooltip, gtk.STOCK_INFO)
					if 'clicked' in i.methods:
						action.connect('activate', i.methods['clicked'])
					item = action.create_tool_item()
					gtk.Toolbar.insert(self, item, -1)
			
		def add_toolbar(self, name, toolbar):
			self.toolbars[name] = toolbar
			

# Dummy class for Toolbar
class Toolbar:

	def __init__(self):
		self.myitems = []
		
	def insert(self, tool, index):
		self.myitems.insert(index, tool)
		
		
# Dummy class for ToolButton
class ToolButton:

	def __init__(self, id):
		self.id = id
		self.tooltip = ''
		self.methods = {}

	def set_tooltip(self, text):
		self.tooltip = text
		
	def set_accelerator(self, key):
		pass
		
	def connect(self, event, callback):
		self.methods[event] = callback