示例#1
0
	def __init__(self, parent, action):
		self.action = action
		artid = action.get_artid()
		tooltip = action.get_tooltip_text()
		text = ''
		if artid is None: text = tooltip
		native = True
		if const.is_winxp(): native = False
		ImageButton.__init__(self, parent, artid, const.DEF_SIZE, text, tooltip,
							native=native, onclick=action.do_call)
		action.register(self)
示例#2
0
	def build(self):
		flags = LEFT | CENTER
		pflags = ALL | EXPAND

		#---------
		p = HPanel(self)
		p.add(Label(p, 'Widgets rendered by native rendering',
				fontbold=True, fontsize=2), 0, flags, 5)
		self.add(p, 0, pflags, 10)

		#---------ImageLabels
		p = HPanel(self, border=BOTTOM, space=2)

		p.add(Label(p, 'ImageLabels:'), 0, flags, 5)

		p.add(ImageLabel(p, text='<Image label>', fontbold=True,
			tooltip='this is label', onclick=self.repeat_test), 0, flags, 5)

		p.add(ImageLabel(p, wx.ART_FILE_OPEN, const.SIZE_16, padding=5,
			tooltip='this is label2', onclick=self.repeat_test), 0, flags, 5)

		self.ilab1 = ImageLabel(p, wx.ART_COPY, const.SIZE_16, padding=5,
			tooltip='this is label3', text='Copy', onclick=self.repeat_test)
		p.add(self.ilab1)

		il = ImageLabel(p, text='<Image label disabled>', fontbold=True,
			tooltip='this is disabled label', onclick=self.repeat_test)
		il.set_enable(False)
		p.add(il, 0, flags, 5)

		b = Button(p, 'Change', onclick=self.test_ilab1)
		p.add(b, 0, flags, 5)

		self.add(p, 0, pflags)

		#---------ImageButtons
		p = HPanel(self, border=BOTTOM, space=2)
		p.add(Label(p, 'ImageButtons:'), 0, flags, 5)

		p.add(ImageButton(p, text='<Image button>', flat=False, fontbold=True,
				tooltip='this is button', onclick=self.repeat_test), 0, flags, 5)

		p.add(ImageButton(p, wx.ART_FILE_OPEN, const.SIZE_32,
			tooltip='this is button2', onclick=self.repeat_test), 0, flags, 5)

		p.add(ImageButton(p, wx.ART_COPY, const.SIZE_16,
			tooltip='this is label3', text='Clipboard',
			onclick=self.repeat_test), 0, flags, 5)

		ib = ImageButton(p, wx.ART_COPY, const.SIZE_16,
			tooltip='this is label3', text='Clipboard',
			onclick=self.repeat_test)
		ib.set_enable(False)
		p.add(ib, 0, flags, 5)

		self.add(p, 0, pflags)

		#---------ImageToggleButtons
		p = HPanel(self, border=BOTTOM, space=2)
		p.add(Label(p, 'ImageToggleButtons:'), 0, flags, 5)

		p.add(ImageToggleButton(p, text='<Image toggle button>', fontbold=True,
				tooltip='this is button', onchange=self.repeat_test), 0, flags, 5)

		p.add(ImageToggleButton(p, False, wx.ART_FILE_OPEN, const.SIZE_32,
			tooltip='this is button2', onchange=self.repeat_test), 0, flags, 5)

		p.add(ImageToggleButton(p, True, wx.ART_COPY, const.SIZE_16,
			tooltip='this is label3', text='Clipboard',
			onchange=self.repeat_test), 0, flags, 5)

		itb = ImageToggleButton(p, True, wx.ART_FILE_OPEN, const.SIZE_24,
			tooltip='this is label4, disabled', text='Clipboard',
			onchange=self.repeat_test)
		itb.set_enable(False)
		p.add(itb, 0, flags, 5)

		self.add(p, 0, pflags)

		#---------
		p = HPanel(self)
		p.add(Label(p, 'Widgets rendered by generic rendering',
				fontbold=True, fontsize=2), 0, flags, 5)
		self.add(p, 0, pflags, 10)

		#---------Generic ImageButtons
		p = HPanel(self, border=BOTTOM, space=2)
		p.add(Label(p, 'ImageButtons:'), 0, flags, 5)

		p.add(ImageButton(p, text='<Image button>', flat=False, fontbold=True,
				tooltip='this is button', native=False,
				onclick=self.repeat_test), 0, flags, 5)

		p.add(ImageButton(p, wx.ART_FILE_OPEN, const.SIZE_32,
			tooltip='this is button2', native=False,
			onclick=self.repeat_test), 0, flags, 5)

		p.add(ImageButton(p, wx.ART_COPY, const.SIZE_16,
			tooltip='this is label3', text='Clipboard', native=False,
			onclick=self.repeat_test), 0, flags, 5)

		ib = ImageButton(p, wx.ART_COPY, const.SIZE_16,
			tooltip='this is label3', text='Clipboard', native=False,
			onclick=self.repeat_test)
		ib.set_enable(False)
		p.add(ib, 0, flags, 5)

		self.add(p, 0, pflags)

		#---------Generic ImageToggleButtons
		p = HPanel(self, border=BOTTOM, space=2)
		p.add(Label(p, 'ImageToggleButtons:'), 0, flags, 5)

		p.add(ImageToggleButton(p, text='<Image toggle button>', fontbold=True,
				tooltip='this is button', native=False,
				onchange=self.repeat_test), 0, flags, 5)

		p.add(ImageToggleButton(p, False, wx.ART_FILE_OPEN, const.SIZE_32,
			tooltip='this is button2', native=False,
			onchange=self.repeat_test), 0, flags, 5)

		p.add(ImageToggleButton(p, True, wx.ART_COPY, const.SIZE_16,
			tooltip='this is label3', text='Clipboard', native=False,
			onchange=self.repeat_test), 0, flags, 5)

		itb = ImageToggleButton(p, True, wx.ART_FILE_OPEN, const.SIZE_24,
			tooltip='this is label4, disabled', text='Clipboard', native=False,
			onchange=self.repeat_test)
		itb.set_enable(False)
		p.add(itb, 0, flags, 5)

		self.add(p, 0, pflags)
示例#3
0
    def build(self):
        flags = LEFT | CENTER
        pflags = ALL | EXPAND

        #---------
        p = HPanel(self)
        p.add(
            Label(p,
                  'Widgets rendered by native rendering',
                  fontbold=True,
                  fontsize=2), 0, flags, 5)
        self.add(p, 0, pflags, 10)

        #---------ImageLabels
        p = HPanel(self, border=BOTTOM, space=2)

        p.add(Label(p, 'ImageLabels:'), 0, flags, 5)

        p.add(
            ImageLabel(p,
                       text='<Image label>',
                       fontbold=True,
                       tooltip='this is label',
                       onclick=self.repeat_test), 0, flags, 5)

        p.add(
            ImageLabel(p,
                       wx.ART_FILE_OPEN,
                       const.SIZE_16,
                       padding=5,
                       tooltip='this is label2',
                       onclick=self.repeat_test), 0, flags, 5)

        self.ilab1 = ImageLabel(p,
                                wx.ART_COPY,
                                const.SIZE_16,
                                padding=5,
                                tooltip='this is label3',
                                text='Copy',
                                onclick=self.repeat_test)
        p.add(self.ilab1)

        il = ImageLabel(p,
                        text='<Image label disabled>',
                        fontbold=True,
                        tooltip='this is disabled label',
                        onclick=self.repeat_test)
        il.set_enable(False)
        p.add(il, 0, flags, 5)

        b = Button(p, 'Change', onclick=self.test_ilab1)
        p.add(b, 0, flags, 5)

        self.add(p, 0, pflags)

        #---------ImageButtons
        p = HPanel(self, border=BOTTOM, space=2)
        p.add(Label(p, 'ImageButtons:'), 0, flags, 5)

        p.add(
            ImageButton(p,
                        text='<Image button>',
                        flat=False,
                        fontbold=True,
                        tooltip='this is button',
                        onclick=self.repeat_test), 0, flags, 5)

        p.add(
            ImageButton(p,
                        wx.ART_FILE_OPEN,
                        const.SIZE_32,
                        tooltip='this is button2',
                        onclick=self.repeat_test), 0, flags, 5)

        p.add(
            ImageButton(p,
                        wx.ART_COPY,
                        const.SIZE_16,
                        tooltip='this is label3',
                        text='Clipboard',
                        onclick=self.repeat_test), 0, flags, 5)

        ib = ImageButton(p,
                         wx.ART_COPY,
                         const.SIZE_16,
                         tooltip='this is label3',
                         text='Clipboard',
                         onclick=self.repeat_test)
        ib.set_enable(False)
        p.add(ib, 0, flags, 5)

        self.add(p, 0, pflags)

        #---------ImageToggleButtons
        p = HPanel(self, border=BOTTOM, space=2)
        p.add(Label(p, 'ImageToggleButtons:'), 0, flags, 5)

        p.add(
            ImageToggleButton(p,
                              text='<Image toggle button>',
                              fontbold=True,
                              tooltip='this is button',
                              onchange=self.repeat_test), 0, flags, 5)

        p.add(
            ImageToggleButton(p,
                              False,
                              wx.ART_FILE_OPEN,
                              const.SIZE_32,
                              tooltip='this is button2',
                              onchange=self.repeat_test), 0, flags, 5)

        p.add(
            ImageToggleButton(p,
                              True,
                              wx.ART_COPY,
                              const.SIZE_16,
                              tooltip='this is label3',
                              text='Clipboard',
                              onchange=self.repeat_test), 0, flags, 5)

        itb = ImageToggleButton(p,
                                True,
                                wx.ART_FILE_OPEN,
                                const.SIZE_24,
                                tooltip='this is label4, disabled',
                                text='Clipboard',
                                onchange=self.repeat_test)
        itb.set_enable(False)
        p.add(itb, 0, flags, 5)

        self.add(p, 0, pflags)

        #---------
        p = HPanel(self)
        p.add(
            Label(p,
                  'Widgets rendered by generic rendering',
                  fontbold=True,
                  fontsize=2), 0, flags, 5)
        self.add(p, 0, pflags, 10)

        #---------Generic ImageButtons
        p = HPanel(self, border=BOTTOM, space=2)
        p.add(Label(p, 'ImageButtons:'), 0, flags, 5)

        p.add(
            ImageButton(p,
                        text='<Image button>',
                        flat=False,
                        fontbold=True,
                        tooltip='this is button',
                        native=False,
                        onclick=self.repeat_test), 0, flags, 5)

        p.add(
            ImageButton(p,
                        wx.ART_FILE_OPEN,
                        const.SIZE_32,
                        tooltip='this is button2',
                        native=False,
                        onclick=self.repeat_test), 0, flags, 5)

        p.add(
            ImageButton(p,
                        wx.ART_COPY,
                        const.SIZE_16,
                        tooltip='this is label3',
                        text='Clipboard',
                        native=False,
                        onclick=self.repeat_test), 0, flags, 5)

        ib = ImageButton(p,
                         wx.ART_COPY,
                         const.SIZE_16,
                         tooltip='this is label3',
                         text='Clipboard',
                         native=False,
                         onclick=self.repeat_test)
        ib.set_enable(False)
        p.add(ib, 0, flags, 5)

        self.add(p, 0, pflags)

        #---------Generic ImageToggleButtons
        p = HPanel(self, border=BOTTOM, space=2)
        p.add(Label(p, 'ImageToggleButtons:'), 0, flags, 5)

        p.add(
            ImageToggleButton(p,
                              text='<Image toggle button>',
                              fontbold=True,
                              tooltip='this is button',
                              native=False,
                              onchange=self.repeat_test), 0, flags, 5)

        p.add(
            ImageToggleButton(p,
                              False,
                              wx.ART_FILE_OPEN,
                              const.SIZE_32,
                              tooltip='this is button2',
                              native=False,
                              onchange=self.repeat_test), 0, flags, 5)

        p.add(
            ImageToggleButton(p,
                              True,
                              wx.ART_COPY,
                              const.SIZE_16,
                              tooltip='this is label3',
                              text='Clipboard',
                              native=False,
                              onchange=self.repeat_test), 0, flags, 5)

        itb = ImageToggleButton(p,
                                True,
                                wx.ART_FILE_OPEN,
                                const.SIZE_24,
                                tooltip='this is label4, disabled',
                                text='Clipboard',
                                native=False,
                                onchange=self.repeat_test)
        itb.set_enable(False)
        p.add(itb, 0, flags, 5)

        self.add(p, 0, pflags)