Esempio n. 1
0
        def __init__(self, delegate=Delegate()):
            gtk.VBox.__init__(self, 25)
            self.set_border_width(25)

            #
            # model
            self.delegate = delegate
            self.instr_s = PrototypeController.PrototypeView.instructions()
            self.instr_buf = gtk.TextBuffer()
            self.instr_buf.set_text(self.instr_s)

            #
            # ui
            self.vbox1 = gtk.VBox()

            #
            # vbox1
            # top: instructions
            # middle: entry
            # bottom: generate code+unicode picker
            #

            #
            # top
            self.instr = gtk.TextView(self.instr_buf)
            self.instr.set_editable(False)
            self.instr.set_wrap_mode(gtk.WRAP_WORD)

            #
            # middle
            hbox = gtk.HBox()
            label = gtk.Label("Desired Button Label: ")
            self.entry = gtk.Entry()
            hbox.pack_start(label, False)
            hbox.pack_start(self.entry)

            #
            # bottom
            self.gen1button = gtk.Button("Generate Code")
            self.unibutton = gtk.Button("Unicode Picker")
            # hook up button clicks
            self.gen1button.connect("clicked", self.gen1_clicked)
            self.unibutton.connect("clicked", self.uni_clicked)

            # add components to vbox
            self.vbox1.pack_start(self.instr, False)
            self.vbox1.pack_start(hbox)
            self.vbox1.pack_start(self.unibutton, False)
            self.vbox1.pack_start(self.gen1button, False)
            self.vbox1.show()
            self.add(self.vbox1)

            #
            # vbox2
            # name field
            # button layout info field
            #

            self.vbox2 = gtk.VBox()
            hbox1 = gtk.HBox()
            # title
            title_label = gtk.Label('Controller Title: ')
            self.title_entry = gtk.Entry()
            hbox1.pack_start(title_label, False)
            hbox1.pack_start(self.title_entry)
            # tl
            hbox2 = gtk.HBox()
            tl_label = gtk.Label('Top-Left Description: ')
            self.tl_entry = gtk.Entry()
            hbox2.pack_start(tl_label, False)
            hbox2.pack_start(self.tl_entry)
            # tr
            hbox3 = gtk.HBox()
            tr_label = gtk.Label('Top-Right Description: ')
            self.tr_entry = gtk.Entry()
            hbox3.pack_start(tr_label, False)
            hbox3.pack_start(self.tr_entry)
            # bl
            hbox4 = gtk.HBox()
            bl_label = gtk.Label('Bottom-Left Description: ')
            self.bl_entry = gtk.Entry()
            hbox4.pack_start(bl_label, False)
            hbox4.pack_start(self.bl_entry)
            # bm
            hbox5 = gtk.HBox()
            bm_label = gtk.Label('Bottom-Middle Description: ')
            self.bm_entry = gtk.Entry()
            hbox5.pack_start(bm_label, False)
            hbox5.pack_start(self.bm_entry)
            # br
            hbox6 = gtk.HBox()
            br_label = gtk.Label('Bottom-Right Description: ')
            self.br_entry = gtk.Entry()
            hbox6.pack_start(br_label, False)
            hbox6.pack_start(self.br_entry)

            # buttons
            self.back = gtk.Button('Go Back')
            self.gen2button = gtk.Button('Generate Code')
            # hook em up
            self.back.connect('clicked', self.go2gen1)
            self.gen2button.connect('clicked', self.gen2_clicked)

            self.vbox2.pack_start(hbox1)
            self.vbox2.pack_start(hbox2)
            self.vbox2.pack_start(hbox3)
            self.vbox2.pack_start(hbox4)
            self.vbox2.pack_start(hbox5)
            self.vbox2.pack_start(hbox6)
            self.vbox2.pack_start(self.back, False)
            self.vbox2.pack_start(self.gen2button, False)

            self.vbox2.show_all()

            #
            # embed the unicode picker in the view
            self.unicode_view = UnicodePickerView(self)
            self.unicode_view.show_all()