-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenuBar.kv
More file actions
223 lines (201 loc) · 7.65 KB
/
MenuBar.kv
File metadata and controls
223 lines (201 loc) · 7.65 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
#:kivy 1.9.0
<MenuBar>:
loadB: loadB
reloadB: reloadB
saveB: saveB
saveAsB: saveAsB
undoB: undoB
redoB: redoB
runB: runB
argsInput: argsInput
height: 24
BoxLayout:
orientation: 'horizontal'
size_hint: (1,1)
pos_hint: {'x':0, 'y':0}
Image:
size_hint: (None,1)
width: self.height
source: 'icons/Python-icon.png'
MenuButton:
id: loadB
on_release: root.loadVersion()
imageSource: 'icons/Open-File-icon.png'
MenuButton:
id: reloadB
pressable: False
on_release: root.reloadFromTemplate()
imageSource: 'icons/Refresh-icon.png'
MenuButton:
id: saveB
pressable: False
on_release: root.saveCurrentVersion()
imageSource: 'icons/Save-icon.png'
MenuButton:
id: saveAsB
on_release: root.saveCurrentVersionAs()
imageSource: 'icons/Save-As-icon.png'
MenuSpacer:
MenuButton:
id: toggleMakerB
on_release: root.toggleBlockMaker()
imageSource: 'icons/Bricks-icon.png'
MenuSpacer:
MenuButton:
id: undoB
pressable: False
on_release: root.undoLast()
imageSource: 'icons/Undo-icon.png'
MenuButton:
id: redoB
pressable: False
on_release: root.redoLast()
imageSource: 'icons/Redo-icon.png'
MenuSpacer:
MenuButton:
id: runB
pressable: False
on_release: root.saveAndRunCode()
imageSource: 'icons/Run-icon.png'
Label:
size_hint: (None,1)
width: self.texture_size[0]
text: ' Args: '
TextInput:
id: argsInput
size_hint: (None,1)
multiline: False
write_tab: False
MenuSpacer:
MenuButton:
id: helpB
pressable: True
on_release: root.displayHelp()
imageSource: 'icons/Help-icon.png'
<MenuButton>:
size_hint: (None,1)
width: self.height
on_pressable: image.color = [1,1,1,1] if self.pressable else [.3,.3,.3,.5]
Image:
id: image
source: root.imageSource
center_x: self.parent.center_x
center_y: self.parent.center_y
<MenuSpacer>:
size_hint: (None,1)
width: root.height / 3
<HelpPopup>:
title: "Python Pieces Help"
size_hint: (.75,.75)
pos_hint: {'center_x':.5, 'center_y':.5}
<HelpScreen>:
size_hint: (1,1)
do_scroll_x: False
do_scroll_y: True
scroll_timeout: 50
StackLayout:
orientation: 'lr-tb'
size_hint: (1, None)
height: self.minimum_height
HelpLabel:
text: " "
HelpLabel:
text: " Python Pieces is an educational programming environment which features drag-and-drop code blocks. It is also touch-compatible! Here's a brief explanation of how to use Python Pieces, including the different buttons on the Menu Bar. For a more detailed usage manual, please consult the README."
HelpLabel:
text: " "
HelpLabel:
text: "[b]Menu Bar Buttons[/b]"
font_size: 20
HelpLabel:
text: " "
HelpImage:
source: 'icons/Open-File-icon.png'
HelpLabel:
text: " Press [b]Open File[/b] to browse for and load a Python Pieces Project (.pyp) or a Python Pieces Template (.pypt)."
HelpImage:
source: 'icons/Refresh-icon.png'
HelpLabel:
text: " Press [b]Reset To Template[/b] to reset the Workspace to the Template that the Project was originally loaded from, if any. You can also press [b]Ctrl-Shift-Backspace[/b] to reset. (Don't worry if you accidentally click this -- you can always hit [b]Undo[/b]!)"
HelpImage:
source: 'icons/Save-icon.png'
HelpLabel:
text: " Press [b]Save File[/b] to save the project to the current Python Pieces File (.pyp) file. You can also press [b]Ctrl-S[/b] to save. [i](Note that if the project was loaded from a Python Pieces Template (.pypt) or any other file format, the project will be saved to .pyp file format, possibly overwriting existing an existing file.)[/i]"
HelpImage:
source: 'icons/Save-As-icon.png'
HelpLabel:
text: " Press [b]Save File As...[/b] to save the project with a given name and extension. You can also press [b]Ctrl-Shift-S[/b] to save as. [i](Note that renaming the project may disrupt Refresh From Template functionality, as well as code insertion when running code.) [/i]"
HelpImage:
source: 'icons/Bricks-icon.png'
HelpLabel:
text: " Press [b]Toggle Block Maker[/b] to show or hide the Block Maker, which can create and destroy custom Code Blocks that will be put in the Block Box."
HelpImage:
source: 'icons/Undo-icon.png'
HelpLabel:
text: " Press [b]Undo[/b] to undo the last change made to the Workspace. You can also press [b]Ctrl-Z[/b] or [b]Ctrl-U[/b], although when entering text into the Block Maker [b]Ctrl-Z[/b] will only undo changes in typed text."
HelpImage:
source: 'icons/Redo-icon.png'
HelpLabel:
text: " Press [b]Redo[/b] to Redo the last Undo made to the Workspace. You can also press [b]Ctrl-R[/b] or [b]Ctrl-Y[/b], although when entering text into the Block Maker [b]Ctrl-R[/b] will only redo changes in typed text."
HelpImage:
source: 'icons/Run-icon.png'
HelpLabel:
text: " Press [b]Run Program[/b] to compile the project code into a .py Python file and run the program in a new safe Command Prompt. Any arguments written in the [b]Args:[/b] box will be passed to the program. You can also press [b]Ctrl-Enter[/b] to run."
HelpLabel:
text: " "
HelpLabel:
text: " You can also adjust the [b]Font Size Slider[/b] to change the display font size in the Workspace."
HelpLabel:
text: " "
HelpLabel:
text: "[b]Getting Around The Workspace[/b]"
font_size: 24
HelpLabel:
text: " "
HelpLabel:
text: " The Python Pieces Workspace is made up of two parts: the Block Box on the left, and the Code Space on the right. You can drag the divider in the middle to adjust how large each side is. Code Blocks from the Block Box can be dragged over to the Code Space to construct the program. "
HelpLabel:
text: " "
HelpLabel:
text: "[b]The Block Box[/b]"
font_size: 20
HelpLabel:
text: " "
HelpLabel:
text: " The Block Box contains the Code Blocks used in your project. Code Blocks inside the Block Box can be rearranged simply by dragging and dropping inside the Block Box. Those Blocks can be dragged over to the Code Space to construct the program. Certain Blocks can be limited in the number of times it is used in the program. If the Block Maker is open, you can remove/edit a Block from the Block Box by dragging it back into the Block Maker"
HelpLabel:
text: " "
HelpLabel:
text: "[b]The Code Space[/b]"
font_size: 20
HelpLabel:
text: " "
HelpLabel:
text: " Blocks in the Code Space go into Code Lines, and can be moved between and around inside each Line. Drag a block from the Code Space outside the Code Space to remove it. Double tap the number on the left of a Line to add another Line below. Drag the number to move a Line to another spot. Click the [b]X[/b] on the right of a Line to remove it and all the Blocks inside."
HelpLabel:
text: " "
HelpLabel:
text: "[b]The Block Maker[/b]"
font_size: 20
HelpLabel:
text: " "
HelpLabel:
text: " The Block Maker appears above the Block Box when the [b]Toggle Block Maker[/b] button is pressed. You can create a new Code Block in the Block Box by entering text in the large text box and pressing [b]Make[/b] or hitting [b]Enter[/b]. You can also set a limited number of uses by entering a number next to [b]Limit:[/b]. Pressing the [b]Color[/b] button displays options for text color and background color of the Block; the create Block will have the text and background color of the [b]Color[/b] button."
HelpLabel:
text: " "
<HelpLabel>:
size_hint_y: None
size_hint_x: 1
text_size: self.width, None
height: self.texture_size[1]
halign: 'left'
valign: 'top'
markup: True
# canvas:
# Color:
# rgba: .5,.5,.5,1
# Line:
# rectangle: self.x,self.y,self.width,self.height
<HelpImage>:
size_hint: (None,None)
width: 24
height:24