Esempio n. 1
0
def newrecord(action, pui, allowreduced=False):

    header = ("Add a new record", )

    if pui.config.db.is_open():
        if pui.config.reducedinput and allowreduced:
            editwin = wizard.FuelpadEdit(pui.config, 1)
        else:
            editwin = wizard.FuelpadFullEdit(pui, False)
        if hildon and pui.config.reducedinput and allowreduced:
            dialog = hildon.WizardDialog(pui, header[0], editwin)
        else:
            dialog = gtk.Dialog(header[0], pui, gtk.DIALOG_MODAL,
                                (gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
                                 gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT))
            dialog.vbox.pack_start(editwin, True, True, 0)

        editwin.show_all()

        dialog.connect("response", add_record_response, editwin, pui)

    else:
        dialog = gtk.Dialog(header[0], pui, gtk.DIALOG_MODAL,
                            (gtk.STOCK_OK, gtk.RESPONSE_REJECT))

        label = gtk.Label(
            "Can't access database - adding records not possible")
        dialog.vbox.pack_start(label, True, True, 5)
        label.show()

        dialog.connect("response", destroy_event, None)

    dialog.show()
Esempio n. 2
0
def main():
    notebook = gtk.Notebook()
    label_1 = gtk.Label("Page 1")
    label_2 = gtk.Label("Page 2")

    entry_3 = hildon.Entry(gtk.HILDON_SIZE_AUTO)
    entry_3.set_placeholder("Write something to continue")

    label_4 = gtk.Label("Page 4")

    notebook.append_page(label_1, None)
    notebook.append_page(label_2, None)
    notebook.append_page(entry_3, None)
    notebook.append_page(label_4, None)

    dialog = hildon.WizardDialog(None, "Wizard", notebook)

    def on_page_switch(n, p, num, d):
        print >> sys.stderr, "Page %d" % num
        return True

    def some_page_func(n, current, userdata):
        if current == 2:
            entry = n.get_nth_page(current)
            return len(entry.get_text()) != 0
        return True

    notebook.connect("switch-page", on_page_switch, dialog)

    dialog.set_forward_page_func(some_page_func)

    dialog.show_all()
    dialog.run()
 def test_constructor(self):
     d = hildon.WizardDialog(gtk.Window(), "Wizard", gtk.Notebook())
     self.assertTrue(type(d) is hildon.WizardDialog)
     d = hildon.WizardDialog(None, "Wizard", gtk.Notebook())
     self.assertTrue(type(d) is hildon.WizardDialog)
 def test_set_page_destroy_not_implemented(self):
     d = hildon.WizardDialog(None, "Wizard", gtk.Notebook())
     self.assertRaises(NotImplementedError, d.set_forward_page_func,
                       lambda n, c, u: None, None, lambda: None)
 def test_set_page_func(self):
     d = hildon.WizardDialog(None, "Wizard", gtk.Notebook())
     d.set_forward_page_func(lambda n, c, u: None)
 def test_constructor(self):
     d = hildon.WizardDialog(gtk.Window(), "Wizard", gtk.Notebook())
     self.assertTrue(isinstance(d, hildon.WizardDialog))
     d = hildon.WizardDialog(None, "Wizard", gtk.Notebook())
     self.assertTrue(isinstance(d, hildon.WizardDialog))