Ejemplo n.º 1
0
    def __init__(self):
        self.table = Table(3, 1)
        radio_frame = create_vframe('Select A Gig')

        group = None
        for i, s in enumerate(sorted(GIG_CHOICES.keys())):

            btn = RadioButton (s, group)
            if i == 0:
                group = btn

            btn.child.multiline = True
            radio_frame.add_child (btn)

        group.activate()

        self.button = Button('SELECT GIG')

        self.doctor_button = Button('Go to Doctors surgery')



        self.radios = group.list

        self.table.add_child(0, 0, radio_frame)
        self.table.add_child(1, 0, self.button)
        self.table.add_child(2, 0, self.doctor_button)
Ejemplo n.º 2
0
class GigWidget(object):
    def __init__(self):
        self.table = Table(3, 1)
        radio_frame = create_vframe('Select A Gig')

        group = None
        for i, s in enumerate(sorted(GIG_CHOICES.keys())):

            btn = RadioButton (s, group)
            if i == 0:
                group = btn

            btn.child.multiline = True
            radio_frame.add_child (btn)

        group.activate()

        self.button = Button('SELECT GIG')

        self.doctor_button = Button('Go to Doctors surgery')



        self.radios = group.list

        self.table.add_child(0, 0, radio_frame)
        self.table.add_child(1, 0, self.button)
        self.table.add_child(2, 0, self.doctor_button)
Ejemplo n.º 3
0
    def __init__(self):
        self.table = Table(3, 1)

        radio_frame = create_vframe('Hi there...\nWhat do you want?')

        group = None
        for i, s in enumerate(sorted(DOCTOR_CHOICES.keys())):

            btn = RadioButton(s, group)
            if i == 0:
                group = btn

            btn.child.multiline = True
            radio_frame.add_child(btn)

        group.activate()

        self.button = Button('Tell doctor')

        self.radios = group.list

        self.stats = Label(player.player.get_stats_text())
        self.stats.multiline = True
        self.stats.align = ALIGN_LEFT

        self.table.add_child(0, 0, radio_frame)
        self.table.add_child(1, 0, self.button)
        self.table.add_child(2, 0, self.stats)

        # doesn't work for some reason...
        if 0:
            group.topleft = (640 - self.table.width, 0)
            radio_frame.topleft = (640 - self.table.width, 0)
            self.table.topleft = (640 - self.table.width, 0)
Ejemplo n.º 4
0
class DoctorWidget(object):
    def __init__(self):
        self.table = Table(3, 1)

        radio_frame = create_vframe('Hi there...\nWhat do you want?')


        group = None
        for i, s in enumerate(sorted(DOCTOR_CHOICES.keys())):

            btn = RadioButton (s, group)
            if i == 0:
                group = btn

            btn.child.multiline = True
            radio_frame.add_child (btn)

        group.activate()

        self.button = Button('Tell doctor')

        self.radios = group.list


        self.stats = Label (player.player.get_stats_text())
        self.stats.multiline = True
        self.stats.align= ALIGN_LEFT


        self.table.add_child(0, 0, radio_frame)
        self.table.add_child(1, 0, self.button)
        self.table.add_child(2, 0, self.stats)





        # doesn't work for some reason...
        if 0:
            group.topleft = (640 - self.table.width,0)
            radio_frame.topleft = (640 - self.table.width,0)
            self.table.topleft = (640 - self.table.width,0)
Ejemplo n.º 5
0
	def get_settings_window(self,title,pos,settings):
		window=Window(title)
		window.child=Table(2,1)
		window.topleft=pos
		window.depth=1

		def brightness_changed(scale,label):
			self.settings.brightness=scale.value
			label.text='%3.2f'%self.settings.brightness
		def brightness_toggle_changed(toggle):
			self.settings.brightness_enable=not toggle.active
		def contrast_changed(scale,label):
			self.settings.contrast=scale.value
			label.text='%3.2f'%self.settings.contrast
		def contrast_toggle_changed(toggle):
			self.settings.contrast_enable=not toggle.active
		def threshold_changed(scale,label):
			self.settings.threshold=scale.value
			label.text='%d'%self.settings.threshold
		def threshold_toggle_changed(toggle):
			self.settings.threshold_enable=not toggle.active
		def points_toggle_changed(toggle):
			self.settings.points_enable=not toggle.active

		#Setup the slider table
		slider_table=Table(4,4)
		window.child.add_child(0,0,slider_table)

		brightness_label=Label('Brightness:')
		brightness_toggle=ToggleButton('')
		brightness_value_label=Label('')
		brightness_scale=HScale(0,2,0.1)
		brightness_scale.connect_signal(SIG_VALCHANGED,brightness_changed,brightness_scale,brightness_value_label)
		brightness_toggle.connect_signal(SIG_CLICKED,brightness_toggle_changed,brightness_toggle)

		slider_table.add_child(0,0,brightness_label)
		slider_table.add_child(0,1,brightness_toggle)
		slider_table.add_child(0,2,brightness_scale)
		slider_table.add_child(0,3,brightness_value_label)

		brightness_toggle.active=True
		brightness_scale.value=self.settings.brightness

		contrast_label=Label('Contrast:')
		contrast_toggle=ToggleButton('')
		contrast_value_label=Label('')
		contrast_scale=HScale(0,2,0.1)
		contrast_scale.connect_signal(SIG_VALCHANGED,contrast_changed,contrast_scale,contrast_value_label)
		contrast_toggle.connect_signal(SIG_CLICKED,contrast_toggle_changed,contrast_toggle)

		slider_table.add_child(1,0,contrast_label)
		slider_table.add_child(1,1,contrast_toggle)
		slider_table.add_child(1,2,contrast_scale)
		slider_table.add_child(1,3,contrast_value_label)

		contrast_toggle.active=True
		contrast_scale.value=self.settings.contrast

		threshold_label=Label('Threshold:')
		threshold_toggle=ToggleButton('')
		threshold_value_label=Label('')
		threshold_scale=HScale(0,255,1)
		threshold_scale.connect_signal(SIG_VALCHANGED,threshold_changed,threshold_scale,threshold_value_label)
		threshold_toggle.connect_signal(SIG_CLICKED,threshold_toggle_changed,threshold_toggle)

		slider_table.add_child(2,0,threshold_label)
		slider_table.add_child(2,1,threshold_toggle)
		slider_table.add_child(2,2,threshold_scale)
		slider_table.add_child(2,3,threshold_value_label)

		threshold_toggle.active=True
		threshold_scale.value=self.settings.threshold

		points_label=Label('Transform:')
		points_toggle=ToggleButton('')
		points_toggle.connect_signal(SIG_CLICKED,points_toggle_changed,points_toggle)

		slider_table.add_child(3,0,points_label)
		slider_table.add_child(3,1,points_toggle)

		points_toggle.active=True
		points_toggle.active=True

		def reset_settings(brightness_scale,brightness_toggle,contrast_scale,contrast_toggle,threshold_scale,threshold_toggle,points_toggle,settings):
			settings.brightness=1.0
			settings.brightness_enable=True
			settings.contrast=1.0
			settings.contrast_enable=True
			settings.threshold=100
			settings.threshold_enable=True
			settings.points.clear()
			settings.points_enable=True

			brightness_scale.value=settings.brightness
			contrast_scale.value=settings.contrast
			threshold_scale.value=settings.threshold

			brightness_toggle.active=settings.brightness_enable
			contrast_toggle.active=settings.contrast_enable
			threshold_toggle.active=settings.threshold_enable
			points_toggle.active=settings.points_enable

		reset_button=Button('Reset')
		reset_button.connect_signal(SIG_CLICKED,reset_settings,brightness_scale,brightness_toggle,contrast_scale,contrast_toggle,threshold_scale,threshold_toggle,points_toggle,self.settings)

		window.child.add_child(1,0,reset_button)

		reset_settings(brightness_scale,brightness_toggle,contrast_scale,contrast_toggle,threshold_scale,threshold_toggle,points_toggle,self.settings)

		return window
Ejemplo n.º 6
0
def create_table_view ():
    # Crate and display a Table.
    table = Table (9, 2)
    table.spacing = 5
    table.topleft = 5, 5

    label = Label ("Nonaligned wide Label")
    table.add_child (0, 0, label)
    table.add_child (0, 1, Button ("Simple Button"))

    label = Label ("Top align")
    table.add_child (1, 0, label)
    table.set_align (1, 0, ALIGN_TOP)
    table.add_child (1, 1, Button ("Simple Button"))

    label = Label ("Bottom align")
    table.add_child (2, 0, label)
    table.set_align (2, 0, ALIGN_BOTTOM)
    table.add_child (2, 1, Button ("Simple Button"))
    
    label = Label ("Left align")
    table.add_child (3, 0, label)
    table.set_align (3, 0, ALIGN_LEFT)
    table.add_child (3, 1, Button ("Simple Button"))
    
    label = Label ("Right align")
    table.add_child (4, 0, label)
    table.set_align (4, 0, ALIGN_RIGHT)
    table.add_child (4, 1, Button ("Simple Button"))

    label = Label ("Topleft align")
    table.add_child (5, 0, label)
    table.set_align (5, 0, ALIGN_TOP | ALIGN_LEFT)
    table.add_child (5, 1, Button ("Simple Button"))

    label = Label ("Topright align")
    table.add_child (6, 0, label)
    table.set_align (6, 0, ALIGN_TOP | ALIGN_RIGHT)
    table.add_child (6, 1, Button ("Simple Button"))

    label = Label ("Bottomleft align")
    table.add_child (7, 0, label)
    table.set_align (7, 0, ALIGN_BOTTOM |ALIGN_LEFT)
    table.add_child (7, 1, Button ("Simple Button"))

    label = Label ("Bottomright align")
    table.add_child (8, 0, label)
    table.set_align (8, 0, ALIGN_BOTTOM |ALIGN_RIGHT)
    table.add_child (8, 1, Button ("Simple Button"))

    return table