Пытаюсь создать приложение с древовидной структурой и меню - панелью действий, они отображаются там, как вы можете видеть на картинке, но я не могу их нажимать, они ничего не делают. Я пробовал использовать BoxLayout, GridLayout и FloatLayout, но ничего не изменилось. Также пробовал после вызова функции "set_current_user" удалить виджет и создать его снова, но безуспешно, есть идеи, как это решить? Спасибо!
<CloudView>:
name: "cloud"
id: cloud_view
on_pre_enter: root.set_current_user()
tv: tv
actionmenu: actionmenu
my_layout: my_layout
GridLayout:
id: my_layout
rows: 3
TreeView:
id: tv
Button:
text: 'hhh'
on_release: root.do_something()
ActionBar:
id: actionmenu
pos_hint: {'top':1}
ActionView:
use_separator: True
ActionPrevious:
title: 'Action Bar'
with_previous: False
on_release: root.do_something()
ActionOverflow:
ActionButton:
text: 'Btn0'
on_release: root.do_something()
icon: 'atlas://data/images/defaulttheme/audio-volume-high'
ActionButton:
text: 'Btn1'
on_release: print('Btn1 Pressend')
ActionButton:
text: 'Btn2'
ActionGroup:
text: 'Group 1'
ActionButton:
text: 'Btn3'
ActionButton:
text: 'Btn4'
ActionGroup:
dropdown_width: 200
text: 'Group 2'
ActionButton:
text: 'Btn5'
ActionButton:
text: 'Btn6'
ActionButton:
text: 'Btn7'
класс CloudView:
class CloudView(Screen, BoxLayout, GridLayout):
tv = ObjectProperty(None)
actionmenu = ObjectProperty(None)
copy = ''
cut = ''
global current_user
def __init__(self, **kwargs):
super(CloudView, self).__init__(**kwargs)
self.actionmenu = ActionBar()
self.add_widget(self.actionmenu)
self.tv = TreeView(root_options=dict(text='My Cloud'),
hide_root=False,
indent_level=4, )
populate_tree_view(self.tv, None, self.show_cloud())
self.add_widget(self.tv)
self.selected = ''
self.previous = None
def show_cloud(self):
s.send('CLOUD'.encode('utf-8'))
print('yes')
if current_user is None:
print('default')
s.send('default'.encode('utf-8'))
else:
s.send(current_user.encode('utf-8'))
print(current_user)
file_system = pickle.loads(s.recv(4096))
return file_system.get_tree()
def on_touch_down(self, touch):
node = self.tv.get_node_at_pos(touch.pos)
if not node:
return
if node.disabled:
return
# toggle node or selection ?
if node.x - self.tv.indent_start <= touch.x < node.x:
self.tv.toggle_node(node)
elif node.x <= touch.x:
self.tv.select_node(node)
self.selected = self.tv.selected_node
print(self.get_path(self.selected))
node.dispatch('on_touch_down', touch)
return True
def set_current_user(self):
print('in')
if current_user != self.previous:
self.remove_widget(self.tv)
#self.remove_widget(self.actionmenu)
self.tv = TreeView(root_options=dict(text='My Cloud'),
hide_root=False,
indent_level=4, )
populate_tree_view(self.tv, None, self.show_cloud())
self.add_widget(self.tv)
#self.add_widget(self.create_action())
print('done')
def sign_out(self):
self.manager.current = 'main'
def upload_files(self):
self.manager.current = 'user_file_manager'
def copy_f(self):
self.copy = self.get_path(self.selected)
self.cut = ''
def cut_f(self):
self.cut = self.get_path(self.selected)
self.copy = ''
def paste(self):
s.send('PASTE'.encode('utf-8'))
s.send(current_user.encode('utf-8'))
if self.copy == '':
if self.cut == '':
pass
else:
s.send('CUT'.encode('utf-8'))
s.send(self.cut.encode('utf-8'))
s.send(self.get_path(self.selected).encode('utf-8'))
else:
s.send('COPY'.encode('utf-8'))
s.send(self.copy.encode('utf-8'))
s.send(self.get_path(self.selected).encode('utf-8'))
def rename(self):
show_popup('RENAME')
def get_path(self, node):
parent = node.parent_node
list_path = [node.text]
while parent is not None:
list_path.append(parent.text)
parent = parent.parent_node
final_path = 'C:\\RonCloud'
for i in range(len(list_path)-2, -1, -1):
final_path = final_path + '\\' + list_path[i]
return final_path
как это выглядит