本文整理汇总了Python中kivy.uix.modalview.ModalView类的典型用法代码示例。如果您正苦于以下问题:Python ModalView类的具体用法?Python ModalView怎么用?Python ModalView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModalView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Load
def Load(self):
"""
Load from the Disk
Button > Load()
"""
from functools import partial
from kivy.uix import filechooser
from kivy.uix.filechooser import FileChooserListView, FileChooserIconView
main = ModalView(size_hint=(.8,.8)) # everything on this Modal is 80%
BL = BoxLayout(portrait="vertical")
FLV = FileChooserListView(path="coreEngine/Saved",)
def cTexloader(instance):
Selected = FLV.selection
Selected_Attr = Selected
LStoString = str(Selected_Attr[0])
self.Loader_NoErr(ctexSaved=LStoString,fixedPath=LStoString)
Load_Btn = Button(text="Load this File")
Load_Btn.bind(on_press=cTexloader)
main.add_widget(BL)
BL.add_widget(FLV)
BL.add_widget(Load_Btn)
main.open()
示例2: helpView
def helpView(self):
"""
Show Help/Guides modal (show when help button pressed)
"""
widgets = FloatLayout(size_hint=(None,None),
size=(300,300),
background_color=parse_color("#FF9933"),)
sizer = NumericProperty(30)
main = ModalView(title_color=parse_color("#FF9933"),
title_size=(25),
seperator_height=("9dp"),
separator_color=parse_color("#FF9933"),
#background_color=parse_color("#FF9933"),
size_hint=(None,None),
size=(400,620),
content = Image(source="coreEngine/Images/about.png"),
)
white_bar = Image(source="coreEngine/Images/whitebar.png",
pos=(123,123),
size=(400,400))
logo = Image(source="coreEngine/Images/about.png")
main.add_widget(logo, 1)
main.open()
示例3: save_new
def save_new(self, *args):
print("SAVE_NEW")
print("path", path)
# function to get text from text boxes
servers = open(path +"\\" + 'server.json')
try:
ServerDict = json.load(servers)
except ValueError:
ServerDict = {}
servers.close()
grid = self.children[0]
temp_list = [i.text for i in grid.children[4:0:-1]] # part of list becasue BoxLayout must be excluded
# now need to check if all inputs have text
nonBlock = True
for item in temp_list:
if len(item) < 1:
nonBlock = False
if nonBlock == True:
if temp_list[0] in ServerDict.keys():
p = ModalView(size_hint=(0.7, 0.1))
p.add_widget(Label(text="Wybierz inna nazwe."))
p.open()
else: # here stuff will be saved
ServerDict[temp_list[0]] = {"address":temp_list[1], "login":temp_list[2], "passw":temp_list[3]}
servers = open(path+"\\"+'server.json', 'w')
json.dump(ServerDict, servers)
servers.close()
self.dismiss()
else:
p = ModalView(size_hint=(0.7, 0.1))
p.add_widget(Label(text="Błędne dane. Sprawdź i popraw..."))
p.open()
示例4: card
def card(content, title=None, background_color=None, size=(.7, .5)):
'''Вывод диалоговых окон с кастомным контентом.'''
if not background_color:
background_color = [1.0, 1.0, 1.0, 1]
card = MDCard(size_hint=(1, 1), padding=5) #, background_color=background_color)
if title:
box = BoxLayout(orientation='vertical', padding=dp(8))
box.add_widget(
MDLabel(
text=title, theme_text_color='Secondary', font_style="Title",
size_hint_y=None, height=dp(36)
)
)
box.add_widget(MDSeparator(height=dp(1)))
box.add_widget(content)
card.add_widget(box)
else:
card.add_widget(content)
dialog = ModalView(size_hint=size, background_color=[0, 0, 0, .2])
dialog.add_widget(card)
#dialog.open()
return dialog
示例5: launchSimpleModal
def launchSimpleModal(text):
view = ModalView(size_hint=(0.4, 0.2))
content = SimpleModal(text=text)
view.add_widget(content)
# bind the on_press event of the button to the dismiss function
content.bind(on_press=view.dismiss)
# open the view
view.open()
示例6: choose_color
def choose_color(self):
view = ModalView()
clrpr = ColorPicker()
view.add_widget(clrpr)
view.open()
def on_color(instance, value):
self.color_picked = value
clrpr.bind(color=on_color)
示例7: showGraph
def showGraph (self):
if self.goals:
show = ModalView (size_hint = (1, 1))
close = Factory.ImageButton (size_hint = (1, 1))
close.children[0].source = "graph/" + os.listdir ("graph")[self.current]
close.children[0].size_hint = (1, 1)
close.bind (on_press = show.dismiss)
show.add_widget (close)
show.open()
示例8: showLoading
def showLoading(self,txt="Loading ..."):
cnt=BoxLayout()
lbl=Label(text=txt)
mdl=ModalView(size_hint=(0.9,0.3),auto_dismiss=False)
cnt.add_widget(lbl)
mdl.add_widget(cnt)
mdl.open()
self.loader=mdl
self.setAnimation(self.loader)
示例9: on_touch_down
def on_touch_down(self, touch):
if self.collide_point(touch.pos[0], touch.pos[1]):
content = Rozpoziomowany()
view = ModalView(size_hint=(None, None), size=(400, 400), auto_dismiss=False)
view.add_widget(content)
btn = content.ids['przejscie']
btn2 = content.ids['menu']
btn.bind(on_press=view.dismiss)
btn2.bind(on_press=view.dismiss)
view.open()
示例10: GameOverNote
def GameOverNote(self,survivaltime):
popup = ModalView(size_hint=(0.75, 0.5))
victory_label = Label(text="Game Over\n" + "%0.2f"%survivaltime + " sec", font_size=50)
popup.add_widget(victory_label)
popup.bind(on_dismiss=game.reset)
popup.bind(on_press=popup.dismiss)
popup.open()
示例11: queryTableNames
def queryTableNames(n, callback):
view = ModalView(size_hint=(None, None), size=(400, 200), background_color=(0, 0, 0, .6), auto_dismiss=True)
def save_and_close(x):
view.dismiss()
callback(x)
view.add_widget(QueryTableNamesWidget(n_tables=3, callback=save_and_close))
view.open()
print self.table_names
return self.table_names
示例12: set_language
def set_language(self, language):
language_map = {
"English": "en_US",
"简体中文": "zh_CN"
}
self.parent.configer.lang = language_map.get(language, "en_US")
self.parent.configer.save_config()
# show popup hint
view = ModalView(size_hint=(None, None), size=(0, 0))
view.add_widget(Label(text=_("This will take effect next time you start"), font_size=30))
view.open()
示例13: on_pre_enter
def on_pre_enter(self):
for child in self.ids.grid.children:
child.background_color = [1, 1, 1, 1]
def my_callback(dt):
view.dismiss()
view = ModalView(size=(100, 100))
view.background = 'img.jpg'
view.open()
Clock.schedule_once(my_callback, 5)
示例14: modal_insert
def modal_insert(self):
lbl1 = Label(text='ID', id="lbl")
lbl2 = Label(text='Nome', id="lbl")
lbl3 = Label(text='Preco', id="lbl")
lbl4 = Label(text='IVA', id="lbl")
txt1 = TextInput(text='000', id="txtinp")
txt2 = TextInput(text='Product Name', id="txtinp")
txt3 = TextInput(text='123.45', id="txtinp")
txt4 = TextInput(text='23', id="txtinp")
insertion_grid = GridLayout(cols=2)
insertion_grid.add_widget(lbl1)
insertion_grid.add_widget(txt1)
insertion_grid.add_widget(lbl2)
insertion_grid.add_widget(txt2)
insertion_grid.add_widget(lbl3)
insertion_grid.add_widget(txt3)
insertion_grid.add_widget(lbl4)
insertion_grid.add_widget(txt4)
# create content and assign to the view
content = Button(text='Close me!')
modal_layout = BoxLayout(orientation="vertical")
modal_layout.add_widget(insertion_grid)
def insert_def(self):
input_list = []
for text_inputs in reversed(self.parent.children[2].children):
if text_inputs.id == "txtinp":
input_list.append(text_inputs.text)
print input_list
grid.add_row(input_list, body_alignment, col_size, self)
# print view
# view.dismiss
insert_btn = Button(text="Insert", on_press=insert_def)
modal_layout.add_widget(insert_btn)
modal_layout.add_widget(content)
view = ModalView(auto_dismiss=False)
view.add_widget(modal_layout)
# bind the on_press event of the button to the dismiss function
content.bind(on_press=view.dismiss)
insert_btn.bind(on_release=view.dismiss)
view.open()
示例15: on_back
def on_back(self):
# game still running, ask for user confirmation
if self.state == 'running':
SoundManager.play(Trigger.GAME_PAUSE)
view = ModalView(size_hint=(None, None), size=(600, 400), auto_dismiss=False)
content = Factory.STModalView(title='Spiel abbrechen', text='Das Spiel ist noch nicht beendet.\nWirklich abbrechen?', cb_yes=self.cancel_match, cb_no=self.resume_match)
view.add_widget(content)
view.open()
# game not running anymore
elif self.state in ['finished', 'submitting', 'submit_failed']:
view = ModalView(size_hint=(None, None), size=(600, 400), auto_dismiss=False)
content = Factory.STModalView(title='Spiel abbrechen', text='Das Ergebnis wurde noch nicht hochgeladen.\nWirklich abbrechen?', cb_yes=self.cancel_match)
view.add_widget(content)
view.open()
else:
self.manager.current = 'lounge'