Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Another dialogue issue
-
@Tel said:
The blue link dialogs.py did not work for me.
When you type xxxx.py, this forum put it in blue, even if there is no link 😢
-
@JonB here is a cut down version showing the problem. You will see that the calling thread continues while the dialog is still up.
import sys, dialogs import ui import console import controller global theView class MyView(ui.View): last_content_offset = (-1,-1) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.make_view() self.value = None def make_view(self): self.tv= ui.TextView(title='textview1', frame=self.bounds.inset(10,10),editable = False, border_width=2, bg_color='white', flex='hw') self.update_interval = 1/60 self.tv.height = self.bounds.height-70 self.add_subview(self.tv) tf = ui.TextField(frame = self.bounds.inset(10, 10), text_color='red') #print (self.bounds) tf.frame=(10,240,self.bounds.width-20,40) tf.height =32 tf.delegate = self tf.flex = 'w' tf.begin_editing() self.add_subview(tf) def update(self) : self.tv.content_offset = (0, self.tv.content_size[1] - self.tv.height) if self.tv.content_offset[1] < 0: self.tv.content_offset = (0,0) #if self.tv.content_offset != MyView.last_content_offset : #print ('*',self.tv.content_offset, self.tv.content_size, #self.height) MyView.last_content_offset = self.tv.content_offset def feedback(self, st): self.tv.text += st +'\n' def textfield_did_change(self, textfield): self.value = textfield.text def textfield_should_return(self, textfield): st = textfield.text self.tv.text += '>'+ st + '\n' parse(st) textfield.text='' return True def delayed_close(self) : self.feedback('shutting down...') ui.delay(self.close, 5) def feedback(st): global theView theView.feedback(st) def startView(): global theView print('starting View') theView = MyView(frame = (0,0,800,300), bg_color='white') theView.present(style='sheet', animated=False) return theView #this routine copied from forum, without the decoration, the dialog never gets input, have to cancel Pythonista @ui.in_background def myform_dialog(title='', fields=None,sections=None, done_button_title='ok'): global c sections = [('', fields)] c = dialogs._FormDialogController(title, sections, done_button_title=done_button_title) c.container_view.frame = (0, 0, 500,900) c.container_view.present('sheet') c.container_view.wait_modal() # Get rid of the view to avoid a retain cycle: c.container_view = None print('from myform_dialog:',str(c.values)) if c.was_canceled: return None return c.values #this part actually in the model def parse(st) : fields = [{'title':'name','type':'text','value':st} ] result = myform_dialog(title='Link design', done_button_title='ok',fields=fields, sections=None) feedback(str(result)) print('from parse:',result) if __name__ == "__main__": console.clear() #show just ui startView() ```
-
@Tel no module controller, sorry
Édit: no need, commented
-
@Tel Please, Try this
result = dialogs.form_dialog(title='Link design', done_button_title='ok',fields=fields, sections=None) #result = myform_dialog(title='Link design', done_button_title='ok',fields=fields, sections=None)
-
@cvp that hangs up Pythonista
-
@Tel oups, I don't have that, please restart (NOT REINSTALL) Pythonista
-
@Tel said:
You will see that the calling thread continues while the dialog is still up.
The calling thread does a "print from parse" but I don't see it in console before I press ok in the dialog, thus that works, isn'it?
-
@cvp this is weird. It worked once, after I restarted. Now cannot repeat it, even after restart. Moreover, it seemed to affect Safari. I had to refresh the page before it allowed me to reply.
-
@Tel said:
it seemed to affect Safari. I had to refresh the page before it allowed me to reply.
Not sure of that, I have remarked such problems with this forum since some days.
-
@Tel I' e tried with and without @ui.in_background before def parse, no difference
-
In your "cut down" version, how are you sure that the calling thread continues while the dialog is still up?
-
@cvp system updated to 12.4.1 last night.
This program hangs for me every time, even after restart. -
@Tel Good to know, I'm in 12.4, without any problem...
-
@Tel Are you in the beta version of Pythonista?
-
@cvp when I had the call to myform_dialog, there was a print in there. Now, of course I can’t do any thing.
Running just what I found in App Store.
-
@Tel said:
when I had the call to myform_dialog, there was a print in there
Sorry, I don't understand this sentence (obviously due to my English 😢)
Do you want to say that when the dialog is displayed, you immediately see a "from parse:" in the console, before tapping ok?
-
@cvp it hangs up Pythonista all the time now and I can’t check anything. C’est foutu.
-
@Tel First, reboot your iDevice
-
@Tel and perhaps, back to 12.4?
-
@cvp I rebooted device. It still hangs there. I don’t know how to go back to system 12.4