예제 #1
0
    def error(self, message):
        form = snack.GridForm(self._screen, "Error", 1, 3)

        form.add(snack.TextboxReflowed(40, message), 0, 0)
        form.add(snack.Textbox(0, 2, ""), 0, 1)
        form.add(snack.Button("Quit"), 0, 2)

        form.runOnce()
예제 #2
0
    def modalGUI(self, message, title, l1, l2):
        form = snack.GridForm(self.screen, title, 2, 2)

        textbox = snack.TextboxReflowed(40, message)
        form.add(textbox, 0, 0)
        if not l2:
            b1 = snack.Button(l1)
            form.add(b1, 0, 1)
        else:
            b1 = snack.Button(l1)
            b2 = snack.Button(l2)
            form.add(b1, 0, 1)
            form.add(b2, 1, 1)

        if form.runOnce() == b1:
            return 0
        else:
            return 1
예제 #3
0
	def start(self):
		# Create our discovery list
		form = snack.GridForm(self._screen, "Discovered Hosts", 1, 3)
		self._textbox = snack.Textbox(60, 10, "", scroll=1)
		label = snack.Label("MAC Address         Hostname               Kickstarted")

		form.add(label, 0, 0, anchorLeft=True, padding=(1, 0, 0, 0))
		form.add(self._textbox, 0, 1, padding=(1, 0, 0, 2))
		form.add(snack.Button("Quit"), 0, 2)

		# Call start on the base class to start the thread
		self.daemon = True
		super().start()

		# Launch the form and wait for the quit button to be pressed
		form.runOnce()
예제 #4
0
    def __init__(self,screen,title,msg,ok_button='OK',width=40,height=7,**kargs):
        '''
        This form will create a simple message box at the format of

        +-----------------------------+
        |                             |
        |    Message .............    |
        |    .....................    |
        |    .....................    |
        |    .....................    |
        |    .....................    |
        |    .....................    |
        |    .....................    |
        |    .....................    |
        |    .....................    |
        |                             |
        |          +-------+          |
        |          |  OK   |          |
        |          +-------+          |
        +-----------------------------+

        Variables:
        screen    - the screen to write to
        title     - form title
        msg          - The message to display
        ok_button - The OK button title
        width     - Text box width in columns
        height    - Text box height in lines
        scroll    - Add scrolling  1:yes 0 :no

        Addtional arguments:
        Buttons         - If the keyword Buttons is given,
        it is assumet to be a widget and added to the form insted of the Ok/Cancel Buttons
        '''
        self.TextBox=snack.Textbox(width=width,height=height,text=msg,scroll=0)
        if kargs.get('Buttons',None):
            self.Buttons=kargs['Buttons']
        else:
            self.Buttons=snack.Button(ok_button)
        super(MessageForm,self).__init__(screen,name=title,Widgets=[self.TextBox,self.Buttons])
예제 #5
0
 def __init__(self, text):
     BaseWidget.__init__(self)
     self._widget = snack.Button(text)