Beispiel #1
0
 def SetStyle(self, *styles):
     """Use this at your own risk."""
     st = {
         'blackframe': 7,
         'grayframe': 8,
         'whiteframe': 9,
         'etchedframe': 18
     }
     style = ControlMethods.GetStyleL(self, 'style')
     out = []
     flag = False
     for i in styles:
         if i in st:
             style |= 7 | 8 | 9 | 18
             style ^= 7 | 8 | 9 | 18
             style |= st[i]
             flag = True
         else:
             out.append(i)
     if flag:
         ControlMethods.SetStyleL(self, 'style', style)
         # Not enough
         #self.OffsetWindowSize(1, 1)
         #self.OffsetWindowSize(-1, -1)
         x, y, w, h = self.GetWindowRect().ToSize()
         self.SetWindowSize(0, 0)
         self.SetWindowSize(w, h)
     if out: ControlMethods.SetStyle(self, *out)
Beispiel #2
0
 def SetStyle(self, *styles):
     lv_styles = ['icon', 'report', 'smallicon', 'list']
     style = ControlMethods.GetStyleL(self, 'style')
     out = []
     flag = False
     for i in styles:
         if i in lv_styles:
             style &= (~3)
             style |= lv_styles.index(i)
             flag = True
         else:
             out.append(i)
     if flag: ControlMethods.SetStyleL(self, 'style', style)
     if out: ControlMethods.SetStyle(self, *out)
Beispiel #3
0
    def SetText(self, text):
        """By default set text for static controls is not allowed,
		use this at your own risk."""
        ControlMethods.SetText(self, text)
        x, y, w, h = self.GetWindowRect().ToSize()
        self.SetWindowSize(0, 0)
        self.SetWindowSize(w, h)
Beispiel #4
0
 def GetStyle(self):
     """ """
     styleList = ControlMethods.GetStyle(self)
     if 'right' in styleList or 'center' in styleList or 'leftnowordwrap' in styleList:
         styleList.remove('left')
     if 'simple' in styleList:
         styleList.remove('right')
         styleList.remove('center')
     return styleList
Beispiel #5
0
	def GetStyle(self):
		"""Returns the style for the checkbox."""
		result = ControlMethods.GetStyle(self)
		if isinstance(result, list):
			if 'auto3state' in result:
				result.remove('checkbox')
			elif 'autocheckbox' in result:
				result.remove('checkbox')
		return result
Beispiel #6
0
	def GetText(self, i=0):
		if self.IsSimple():
			return ControlMethods.GetText(self)
		else:
			if i >= self.__len__():	raise IndexError("index out of range")
		n = self.SendMessage(self.Hwnd, self.Msg.SB_GETTEXTLENGTH, i, 0)
		if not n:	return ''
		p = create_string_buffer(LOWORD(n) +1)
		self.SendMessage(self.Hwnd, self.Msg.SB_GETTEXT, i, p)
		return p.value
Beispiel #7
0
 def GetStyle(self):
     styles = ControlMethods.GetStyle(self)
     flag = None
     for i in ('icon', 'report', 'smallicon', 'list'):
         try:
             styles.remove(i)
             flag = i
         except:
             pass
     if flag: styles.append(flag)
     return styles
Beispiel #8
0
 def SetStyle(self, *styles):
     rcStyles = ['blackrect', 'grayrect', 'whiterect']
     rcStyles2 = ['-blackrect', '-grayrect', '-whiterect']
     a, b = [], []
     for i in styles:
         if i in rcStyles: a.append(i)
         else: b.append(i)
     if a:
         rcStyles2.remove('-%s' % a[-1])
         b += rcStyles2 + [a[-1]]
     ControlMethods.SetStyle(self, *b)
     self.RedrawClientArea()
Beispiel #9
0
 def SetStyle(self, *styles):
     """  """
     st = {
         'left': 0,
         'center': 1,
         'right': 2,
         'simple': 11,
         'leftnowordwrap': 12
     }
     style = ControlMethods.GetStyleL(self, 'style')
     out = []
     flag = False
     for i in styles:
         if i in st:
             style |= 1 | 2 | 11 | 12
             style ^= 1 | 2 | 11 | 12
             style |= st[i]
             flag = True
         else:
             out.append(i)
     if flag:
         ControlMethods.SetStyleL(self, 'style', style)
     if out:
         ControlMethods.SetStyle(self, *out)
Beispiel #10
0
 def SetStyle(self, *styles):
     out = []
     fReadonly = None
     for i in styles:
         if 'readonly' in i: fReadonly = i
         else: out.append(i)
     if fReadonly:
         flag = 1
         if fReadonly[0] == '-': flag = 0
         if fReadonly[0] == '~':
             ES_READONLY = 2048
             if self.GetStyleL('style') & ES_READONLY:
                 flag = 0
         self.SendMessage(self.Hwnd, self.Msg.EM_SETREADONLY, flag, 0)
     if out:
         ControlMethods.SetStyle(self, *out)
Beispiel #11
0
    def SetStyle(self, *styles):
        """Sets the style for the checkbox.
		Same as the SetStyle method for other controls, except  
		The styles 'radiobutton', 'autoradiobutton'
		are mutually exclusive. You can not use the flags '-' and
		'~' on them.
		"""
        out = []
        st = ('radiobutton', 'autoradiobutton')
        for i in styles:
            if i in st:
                if i == 'radiobutton': style = 4
                elif i == 'autoradiobutton': style = 9
                self.SendMessage(self.Hwnd, self.Msg.BM_SETSTYLE, style, 1)
            else:
                out.append(i)
            if out:
                ControlMethods.SetStyle(self, *out)
Beispiel #12
0
 def SetFrame(self):
     style = ControlMethods.GetStyleL(self, 'style')
     style |= 7 | 8 | 9 | 16 | 17 | 18
     style ^= 7 | 8 | 9 | 16 | 17 | 18
     style |= 18
     ControlMethods.SetStyleL(self, 'style', style)
Beispiel #13
0
 def GetStyle(self):
     styles = ControlMethods.GetStyle(self)
     if 'whiteframe' in styles:
         styles.remove('grayframe')
     return styles
Beispiel #14
0
 def GetStyle(self):
     styles = ControlMethods.GetStyle(self)
     if 'whiterect' in styles or 'grayrect' in styles:
         styles.remove('blackrect')
     return styles
Beispiel #15
0
	def Close(self): 
		try: self.CloseAnimation()
		except: pass
		ControlMethods.Close(self)