Beispiel #1
0
def showAlert(button):
   alert = Dialog("Alert", 40, 6, dialogs.ALERT_DIALOG_DECO)
   bOk = Button(1, "Ok", dialogs.ALERT_BUTTON_DECO)
   alert.addComponent(Label("Press 'Ok' button to close alert dialog.", 38), 1, 2)
   alert.addComponent(bOk, 31, 4)
   alert.center()

   def ok(button):
      alert.destroy()
      dialog.focus()
  
   bOk.setCallback(ok)
   dialog.unfocus()
   alert.draw()
   alert.focus()
Beispiel #2
0
def start(button):
   progressDialog = Dialog("", 40, 5)
   progress = Progressbar(38, 0, 10)
   progressDialog.addComponent(progress, 1, 2)
   progressDialog.center()

   dialog.unfocus()
   progressDialog.draw()
   progressDialog.focus()

   for i in range(1, 11):
      time.sleep(0.5)
      progress.setValue(i)
   time.sleep(0.5)

   progressDialog.destroy()
   dialog.focus() 
Beispiel #3
0
def ok(button):
   info = Dialog("", 40, 6)
   bInfoOk = Button(1, "Ok")
   label = Label("", 38)
   info.addComponent(label, 1, 2)
   info.addComponent(bInfoOk, 31, 4)
   info.center()

   label.setText("Entered: " + "".join(cmbPath.text))

   def infoOk(button):
      info.destroy()
      dialog.focus()

   bInfoOk.setCallback(infoOk)
   dialog.unfocus()
   info.draw()
   info.focus()
Beispiel #4
0
def ok(button):
   info = Dialog("", 40, 6)
   bInfoOk = Button(1, "Ok")
   label = Label("", 38)
   info.addComponent(label, 1, 2)
   info.addComponent(bInfoOk, 31, 4)
   info.center()

   value = dropdown.getValue()
   label.setText("Selected: " + value['label'] + " (" + value['value'] + ")")

   def infoOk(button):
      info.destroy()
      dialog.focus()

   bInfoOk.setCallback(infoOk)
   dialog.unfocus()
   info.draw()
   info.focus()
Beispiel #5
0
def ok(button):
   info = Dialog("", 40, 6)
   bInfoOk = Button(1, "Ok")
   label = Label("", 38)
   info.addComponent(label, 1, 2)
   info.addComponent(bInfoOk, 31, 4)
   info.center()

   selected = []
   for i in xrange(0, len(checkbox)):
      if checkbox[i].checked:
         selected.append(i + 1)

   label.setText("Selected: " + str(selected))

   def infoOk(button):
      info.destroy()
      dialog.focus()

   bInfoOk.setCallback(infoOk)
   dialog.unfocus()
   info.draw()
   info.focus()
Beispiel #6
0
   alert.focus()
   
 
def cancel(button):
   dialogs.stop()

if __name__ == '__main__':
   try:
      dialogs.initScreen()
      dialogs.setTitle("DEMO")

      dialog = Dialog("Dialog", 60, 10)
      bShowAlert = Button(1, "Alert")
      bCancel = Button(2, "Cancel")
      bShowAlert.setCallback(showAlert)
      bCancel.setCallback(cancel)
      dialog.addComponent(Label("Press 'Alert' button to show alert dialog.", 58), 1, 2)
      dialog.addComponent(bShowAlert, 36, 8)
      dialog.addComponent(bCancel, 47, 8)
      dialog.center()

      dialog.draw()
      dialog.focus()

      dialogs.start()

      dialogs.closeScreen()
   except:
      dialogs.closeScreen()
      print sys.exc_info()
Beispiel #7
0
   dialogs.stop()

def cancel(button):
   dialogs.stop()

if __name__ == '__main__':
   try:
      dialogs.initScreen()
      dialogs.setTitle("DEMO")

      dialog1 = Dialog("Dialog 1", 60, 8)
      bNext1 = Button(1, "Next")
      bCancel1 = Button(2, "Cancel")
      bNext1.setCallback(next)
      bCancel1.setCallback(cancel)
      dialog1.addComponent(bNext1, 37, 6)
      dialog1.addComponent(bCancel1, 47, 6)
      dialog1.center()

      dialog2 = Dialog("Dialog 2", 60, 8)
      bFinish2 = Button(1, "Finish")
      bBack2 = Button(2, "Back")
      bCancel2 = Button(3, "Cancel")
      bFinish2.setCallback(finish)
      bBack2.setCallback(back)
      bCancel2.setCallback(cancel)
      dialog2.addComponent(bFinish2, 25, 6)
      dialog2.addComponent(bBack2, 37, 6)
      dialog2.addComponent(bCancel2, 47, 6)
      dialog2.center()
Beispiel #8
0
   dialogs.stop()

if __name__ == '__main__':
   try:
      dialogs.initScreen()
      dialogs.setTitle("DEMO")

      dialog = Dialog("Dialog", 40, 12)
      cmbPath = Combobox(1, 36)
      bOk = Button(2, "Ok")
      bCancel = Button(3, "Cancel")
      cmbPath.setPopupCallback(path)
      cmbPath.setPopupWidth(60)
      bOk.setCallback(ok)
      bCancel.setCallback(cancel)
      dialog.addComponent(Label("Enter file path (TAB for autocomplete) and press 'Ok' button:", 38), 1, 2)
      dialog.addComponent(cmbPath, 2, 5)
      dialog.addComponent(bOk, 19, 10)
      dialog.addComponent(bCancel, 27, 10)
      dialog.center()

      dialog.draw()
      dialog.focus()

      dialogs.start()

      dialogs.closeScreen()
   except:
      dialogs.closeScreen()
      print sys.exc_info()
Beispiel #9
0
def ok(button):
   dialogs.stop()

if __name__ == '__main__':
   try:
      dialogs.initScreen()
      dialogs.setTitle("DEMO")

      dialog = Dialog("Dialog", 60, 14)
      bMore = Button(1, "More")
      bOk = Button(2, "Ok")
      label = Label("Python is a computer programming language that lets you work more quickly than other programming languages."
                    "Experienced programmers in any other language can pick up Python very quickly, and beginners find the clean syntax and indentation structure easy to learn.\n\n"
                    "From http://pythonprogramminglanguage.com web page.", 58)
      bMore.setCallback(more)
      bOk.setCallback(ok)
      dialog.addComponent(label, 1, 2)
      dialog.addComponent(bMore, 41, 12)
      dialog.addComponent(bOk, 51, 12)
      dialog.center()

      dialog.draw()
      dialog.focus()

      dialogs.start()

      dialogs.closeScreen()
   except:
      dialogs.closeScreen()
      print sys.exc_info()
Beispiel #10
0
   dialogs.stop()

if __name__ == '__main__':
   try:
      dialogs.initScreen()
      dialogs.setTitle("DEMO")

      dialog = Dialog("Dialog", 50, 12)
      for i in xrange(0, len(checkbox)):
         checkbox[i] = Checkbox(i, "Option " + str(i + 1), 48)
         checkbox[i].setCallback(check)
      bOk = Button(4, "Ok")
      bCancel = Button(5, "Cancel")
      bOk.setCallback(ok)
      bCancel.setCallback(cancel)
      dialog.addComponent(Label("Select single option and press 'Ok' button:", 48), 1, 2)
      for i in xrange(0, len(checkbox)):
         dialog.addComponent(checkbox[i], 1, i + 4)
      dialog.addComponent(bOk, 29, 10)
      dialog.addComponent(bCancel, 37, 10)
      dialog.center()

      checkbox[0].check()
      dialog.draw()
      dialog.focus()

      dialogs.start()

      dialogs.closeScreen()
   except:
      dialogs.closeScreen()
Beispiel #11
0
 
def cancel(button):
   dialogs.stop()

if __name__ == '__main__':
   try:
      dialogs.initScreen()
      dialogs.setTitle("DEMO")

      dialog = Dialog("Dialog", 60, 12)
      txtInput = Textfield(1, 58)
      bOk = Button(2, "Ok")
      bCancel = Button(3, "Cancel")
      bOk.setCallback(ok)
      bCancel.setCallback(cancel)
      dialog.addComponent(Label("Enter text and press 'Ok' button:", 58), 1, 2)
      dialog.addComponent(txtInput, 1, 4)
      dialog.addComponent(bOk, 39, 10)
      dialog.addComponent(bCancel, 47, 10)
      dialog.center()

      txtInput.setText("default text")
      dialog.draw()
      dialog.focus()

      dialogs.start()

      dialogs.closeScreen()
   except:
      dialogs.closeScreen()
      print sys.exc_info()
Beispiel #12
0
if __name__ == '__main__':
   try:
      items = [{"label": "Option {}".format(i), "value": "Value {}".format(i)} for i in xrange(1,35)]

      dialogs.initScreen()
      dialogs.setTitle("DEMO")

      dialog = Dialog("Dialog", 52, 8)
      dropdown = Dropdown(1, items, 12)
      bOk = Button(2, "Ok")
      bCancel = Button(3, "Cancel")
      dropdown.setPopupWidth(10)
      bOk.setCallback(ok)
      bCancel.setCallback(cancel)
      dialog.addComponent(Label("Select option and press 'Ok' button:", 38), 1, 2)
      dialog.addComponent(dropdown, 38, 2)
      dialog.addComponent(bOk, 31, 6)
      dialog.addComponent(bCancel, 39, 6)
      dialog.center()

      dialog.draw()
      dialog.focus()

      dialogs.start()

      dialogs.closeScreen()
   except:
      dialogs.closeScreen()
      print sys.exc_info()
Beispiel #13
0
   progressDialog.destroy()
   dialog.focus() 
 
def cancel(button):
   dialogs.stop()

if __name__ == '__main__':
   try:
      dialogs.initScreen()
      dialogs.setTitle("DEMO")

      dialog = Dialog("Dialog", 60, 9)
      bStart = Button(1, "Start")
      bCancel = Button(2, "Cancel")
      bStart.setCallback(start)
      bCancel.setCallback(cancel)
      dialog.addComponent(Label("Press 'Start' button to show progress bar.", 58), 1, 2)
      dialog.addComponent(bStart, 36, 7)
      dialog.addComponent(bCancel, 47, 7)
      dialog.center()

      dialog.draw()
      dialog.focus()

      dialogs.start()

      dialogs.closeScreen()
   except:
      dialogs.closeScreen()
      print sys.exc_info()