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 take_screenshot(self):
     try:
         os.mkdir(os.path.join(directories.getCacheDir(), "screenshots"))
     except OSError:
         pass
     screenshot_name = os.path.join(directories.getCacheDir(), "screenshots", time.strftime("%Y-%m-%d (%I-%M-%S-%p)")+".png")
     pygame.image.save(pygame.display.get_surface(), screenshot_name)
     self.diag = Dialog()
     lbl = Label(_("Screenshot taken and saved as '%s'")%screenshot_name, doNotTranslate=True)
     folderBtn = Button("Open Folder", action=self.open_screenshots_folder)
     btn = Button("Ok", action=self.screenshot_notify)
     buttonsRow = Row((btn,folderBtn))
     col = Column((lbl,buttonsRow))
     self.diag.add(col)
     self.diag.shrink_wrap()
     self.diag.present()
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
   bOk.setCallback(ok)
   dialog.unfocus()
   alert.draw()
   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:
Beispiel #7
0
   dialog1.draw()
   dialog1.focus()

def finish(button):
   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)
Beispiel #8
0
   bInfoOk.setCallback(infoOk)
   dialog.unfocus()
   info.draw()
   info.focus()
 
def cancel(button):
   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()
Beispiel #9
0
                 "Python programs are simply a collection of text files.  If you want something more sophisticated than notepad for editing, you will need a Python IDE (recommended). A Python IDE will make programming Python easier.\n\n"
                 "From http://pythonprogramminglanguage.com web page.")
   button.setVisible(False)
   dialog.draw()
   dialog.focus() 
 
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()
Beispiel #10
0
      progress.setValue(i)
   time.sleep(0.5)

   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: