def __init__(self, **kwargs): self.uBackgroundPic = kwargs['background_pic'] self.uButtonPic = kwargs['button_pic'] self.oText = None super(cSliderEx, self).__init__(**RemoveNoClassArgs(kwargs, Slider)) self.register_event_type('on_slider_moved') self.uMoveType = u'' self.canvas.clear() if self.orientation == u'horizontal': fGap = (self.height - sp(32)) / 2 self.x = self.x + fGap self.fBackGroundSize = self.height / 4 - (fGap) * 2 tKnobPos = (self.value_pos[0] - (self.height / 2), self.value_pos[1]) tKnobSize = (self.height, self.height) self.oKnob = BorderImage(border=(0, 0, 0, 0), pos=tKnobPos, size=tKnobSize, source=self.uButtonPic) self.canvas.add(Color(1., 1., 1.)) self.oBorderImage = BorderImage( border=(0, 0, 0, 0), pos=(self.x, self.center_y - (self.fBackGroundSize / 2)), size=(self.width - fGap, self.fBackGroundSize), source=self.uBackgroundPic) self.canvas.add(self.oBorderImage) else: fGap = (self.width - sp(32)) / 2 self.y = self.y + fGap self.height = self.height - (fGap) * 2 self.fBackGroundSize = self.width / 4 tKnobPos = (self.value_pos[0], self.value_pos[1] - (self.width / 2)) tKnobSize = (self.width, self.width) self.oKnob = BorderImage(border=(0, 0, 0, 0), pos=tKnobPos, size=tKnobSize, source=self.uButtonPic) self.canvas.add(Color(1., 1., 1.)) self.oBorderImage = BorderImage( border=(0, 0, 0, 0), pos=(self.center_x - (self.fBackGroundSize / 2), self.y), size=(self.fBackGroundSize, self.height - fGap), source=self.uBackgroundPic) self.canvas.add(self.oBorderImage) self.canvas.add(self.oKnob) uText = kwargs.get('text') if uText: self.oText = Label(**RemoveNoClassArgs(kwargs, Label)) self.oText.pos = tKnobPos self.oText.size = tKnobSize self.add_widget(self.oText)
def __init__(self, **kwargs): super().__init__( **RemoveNoClassArgs(dInArgs=kwargs, oObject=ColorPicker)) self.register_event_type('on_colorset') self.cFktTouchUp: Callable = self.wheel.on_touch_up self.wheel.on_touch_up = self.On_TouchUpColorWheel
def __init__(self, **kwargs): kwargs['orientation'] = 'vertical' super(cITachToKeene, self).__init__(**RemoveNoClassArgs(kwargs, BoxLayout)) self.uCodesetFileName = '' self.oLayoutHeaders = BoxLayout(size_hint_y=None, height=30) self.oLayoutButtons = BoxLayout(size_hint_y=None, height=30) self.oLayoutPanels = BoxLayout() self.add_widget(self.oLayoutHeaders) self.add_widget(SettingSpacer()) self.add_widget(self.oLayoutPanels) self.add_widget(SettingSpacer()) self.add_widget(self.oLayoutButtons) self.oTextInput = TextInput() self.oTextInput2 = TextInput() self.oLayoutPanels.add_widget(self.oTextInput) self.oLayoutPanels.add_widget(self.oTextInput2) self.oButtonLoad = Button(text=ReplaceVars('$lvar(563)')) self.oButtonSave = Button(text=ReplaceVars('$lvar(5025)')) self.oButtonLoad.bind(on_release=self.show_load) self.oButtonSave.bind(on_release=self.show_save) self.oLayoutButtons.add_widget(self.oButtonLoad) self.oLayoutButtons.add_widget(self.oButtonSave) self.oLabelITach = Label(text="ITach", halign='center') self.oLabelKeene = Label(text="Keene Kira", halign='center') self.oLayoutHeaders.add_widget(self.oLabelITach) self.oLayoutHeaders.add_widget(self.oLabelKeene)
def __init__(self, **kwargs): self.oLayout = FloatLayout(size_hint=(1, 1)) super(SettingPicture, self).__init__(**RemoveNoClassArgs(kwargs, SettingFile)) try: oFnPic = cFileName().ImportFullPath(self.value) self.oPic = Image(source=UnEscapeUnicode(ToAtlas(oFnPic)), size_hint=(1, 1), pos_hint={ 'x': 0.0, 'y': 0.0 }) oFnBack = cFileName(Globals.oPathResources + "pics") + "imagepicker_background.png" self.oBack = Image(source=ToAtlas(oFnBack), size_hint=(1, 1), pos_hint={ 'x': 0.0, 'y': 0.0 }) self.oLayout.add_widget(self.oBack) self.oLayout.add_widget(self.oPic) self.add_widget(self.oLayout) self.content.children[1].text = '' except Exception as e: uMsg = u'Settings: Picture: can\'t load image file: ' + ToUnicode( e) + " " + oFnPic Logger.error(uMsg)
def __init__(self, **kwargs): super(self.__class__, self).__init__(**RemoveNoClassArgs(kwargs, BoxLayout)) self.oLabel = cLabel(**self.oScrollableLabelLargeInner.kwFontArgs) if self.oScrollableLabelLargeInner.oOrcaWidget is not None: self.oLabel.oOrcaWidget = self.oScrollableLabelLargeInner.oOrcaWidget self.add_widget(self.oLabel)
def __init__(self, **kwargs): kwargs['orientation'] = 'vertical' super(cITachToKeene, self).__init__( **RemoveNoClassArgs(dInArgs=kwargs, oObject=BoxLayout)) self.uCodesetFileName: str = '' self.oLayoutHeaders: BoxLayout = BoxLayout(size_hint_y=None, height=30) self.oLayoutButtons: BoxLayout = BoxLayout(size_hint_y=None, height=30) self.oLayoutPanels: BoxLayout = BoxLayout() self.add_widget(self.oLayoutHeaders) self.add_widget(SettingSpacer()) self.add_widget(self.oLayoutPanels) self.add_widget(SettingSpacer()) self.add_widget(self.oLayoutButtons) self.oTextInput: TextInput = TextInput() self.oTextInput2: TextInput = TextInput() self.oLayoutPanels.add_widget(self.oTextInput) self.oLayoutPanels.add_widget(self.oTextInput2) self.oButtonLoad: Button = Button(text=ReplaceVars('$lvar(563)')) self.oButtonSave: Button = Button(text=ReplaceVars('$lvar(5025)')) self.oButtonLoad.bind(on_release=self.show_load) self.oButtonSave.bind(on_release=self.show_save) self.oLayoutButtons.add_widget(self.oButtonLoad) self.oLayoutButtons.add_widget(self.oButtonSave) self.oLabelITach: Label = Label(text="ITach", halign='center') self.oLabelKeene: Label = Label(text="Keene Kira", halign='center') self.oLayoutHeaders.add_widget(self.oLabelITach) self.oLayoutHeaders.add_widget(self.oLabelKeene) self.oContent: Union[FileBrowser, None] = None self._popup: Union[Popup, None] = None self.oXMLCodeset: Union[Element, None] = None
def __init__(self, **kwargs): self.register_event_type('on_release') super().__init__( **RemoveNoClassArgs(dInArgs=kwargs, oObject=SettingNumeric)) self.fMin: float = ToFloat(kwargs["min"]) self.fMax: float = ToFloat(kwargs["max"]) self.iRoundPos: int = int(kwargs["roundpos"]) self.slider: Union[Slider, None] = None self.textvalue: Union[TextInput, None] = None
def __init__(self, **kwargs): self.register_event_type('on_release') super(SettingNumericSlider, self).__init__(**RemoveNoClassArgs(kwargs, SettingNumeric)) self.fMin = ToFloat(kwargs["min"]) self.fMax = ToFloat(kwargs["max"]) self.iRoundPos = int(kwargs["roundpos"]) self.slider = None self.textvalue = None
def __init__(self, **kwargs): self.tBackGroundColor = kwargs.get('background_color', [0.5, 0.5, 0.5, 1]) self.fLineWidth = float(kwargs.get('linewidth', '1.0')) super(cBorder, self).__init__(**RemoveNoClassArgs(kwargs, cBorder)) # create the graphics self.Create_Border() self.bind(pos=self.update_graphics_pos, size=self.update_graphics_size)
def __init__(self, **kwargs): self.register_event_type('on_release') # by purpose: we super to the settingitem directly, as SettingItem tries to read a non existing section super(SettingItem, self).__init__(**RemoveNoClassArgs(kwargs,SettingItem)) for aButton in kwargs["buttons"]: oButton=cMultiLineButton(text=aButton['title'], font_size= '15sp', halign='center', valign='middle') oButton.ID=aButton['id'] self.add_widget(oButton) oButton.bind (on_release=self.On_ButtonPressed)
def __init__(self, **kwargs): self.aBackGroundColor: List[float] = kwargs.get( 'background_color', [0.5, 0.5, 0.5, 1.0]) self.fLineWidth: float = float(kwargs.get('linewidth', '1.0')) self.oLine: Union[Line, None] = None super(cBorder, self).__init__( **RemoveNoClassArgs(dInArgs=kwargs, oObject=cBorder)) # create the graphics self.Create_Border() self.bind(pos=self.update_graphics_pos, size=self.update_graphics_size)
def __init__(self, **kwargs): super().__init__(**RemoveNoClassArgs(dInArgs=kwargs, oObject=Scatter)) self.register_event_type('on_widget_turned') self.bInit: bool = False self.fTotalAngle: float = 0.0 self.iAngle: int = 0 self.iLeftBoundaryAngle: int = 0 self.iRightBoundaryAngle: int = 0 self.uDirection: str = u'right' self.iRightBoundaryAngle: int = 90 self.uMoveType: str = '' self.xx: int = 0 self.yy: int = 0
def __init__(self, **kwargs): Label.__init__(self,**RemoveNoClassArgs(dInArgs=kwargs,oObject=Label)) cOrcaButtonBehaviour.__init__(self,**kwargs) if 'background_color' in kwargs: self.background_color=kwargs['background_color'] if not self.background_color==[0, 0, 0, 0]: with self.canvas.before: Color(self.background_color[0],self.background_color[1], self.background_color[2],self.background_color[3]) self.rect_bg = Rectangle(size=self.size,pos=self.pos) self.bind(pos=self.update_graphics_pos,size=self.update_graphics_size)
def __init__(self, **kwargs): super(cRotateScatter, self).__init__(**RemoveNoClassArgs(kwargs, Scatter)) self.register_event_type('on_widget_turned') self.bInit = False self.fTotalAngle = 0.0 self.iAngle = 0 self.iLeftBoundaryAngle = 0 self.iRightBoundaryAngle = 0 self.uDirection = u'right' self.iRightBoundaryAngle = 90 self.uMoveType = '' self.xx = 0 self.yy = 0
def __init__(self, **kwargs): self.tBackGroundColor = kwargs['background_color'] Widget.__init__(self, **RemoveNoClassArgs(kwargs, Widget)) cOrcaButtonBehaviour.__init__(self, **kwargs) # create the graphics with self.canvas: Color(self.tBackGroundColor[0], self.tBackGroundColor[1], self.tBackGroundColor[2], self.tBackGroundColor[3]) self.rect_bg = Ellipse(pos=self.pos, size=self.size, angle_end=kwargs['angle_end'], angle_start=kwargs['angle_start'], source=kwargs['source']) self.bind(pos=self.update_graphics_pos, size=self.update_graphics_size)
def __init__(self, **kwargs): self.tBackGroundColor = [] cOrcaButtonBehaviour.__init__(self, **kwargs) Widget.__init__(self, **RemoveNoClassArgs(kwargs, Widget)) if 'background_color' in kwargs: self.background_color = kwargs['background_color'] # create the graphics with self.canvas: Color(self.background_color[0], self.background_color[1], self.background_color[2], self.background_color[3]) self.rect_bg = Rectangle(pos=self.pos, size=self.size) self.bind(pos=self.update_graphics_pos, size=self.update_graphics_size)
def CreateBase(self, Parent: Widget, Class: Union[Callable, str]) -> bool: if self.bIsCreated: return True try: self.oParent = Parent self.iPosX = int(self.iPosXInit / self.oDef.fRationX) self.iPosY = int(self.iPosYInit / self.oDef.fRationY) self.iWidth = int(self.iWidthInit / self.oDef.fRationX) self.iHeight = int(self.iHeightInit / self.oDef.fRationY) iKivyPosX: int = self.iPosX + self.iGapX # iKivyPosY:int = Globals.iAppHeight-self.iHeight-self.iPosY-self.iGapY iKivyPosY: int = Parent.height - self.iHeight - self.iPosY - self.iGapY self.AddArg('pos', (iKivyPosX, iKivyPosY)) self.AddArg('size', (self.iWidth, self.iHeight)) if not self.aBackGroundColor == [0.0, 0.0, 0.0, 0.0]: self.AddArg('background_color', self.aBackGroundColor) if not self.bIsEnabled: self.AddArg('opacity', 0) super().CreateBase(Parent, Class) if not Class == '': if Class.__name__.startswith("c"): # Just add to ORCA classes, passing custom parameter to Kivy classes crashes on Python 3 self.dKwArgs['ORCAWIDGET'] = self self.oObject = Class(**self.dKwArgs) else: from ORCA.utils.RemoveNoClassArgs import RemoveNoClassArgs self.oObject = Class(**RemoveNoClassArgs( dInArgs=self.dKwArgs, oObject=Class)) # self.RemoveNoClassArgs(kwargs, Widget)) # self.oObject = Class(**self.dKwArgs) self.oObject.oOrcaWidget = self self.FlipBorder() self.bIsCreated = True return True except Exception as e: LogError(uMsg=u'Can' 't create widget:' + self.uName, oException=e) return False
def __init__(self, **kwargs): kwargsInner = {} for k in kwargs: if k not in ["size_hint", "size", "pos", "pos_hint"]: kwargsInner[k] = kwargs[k] self.oScrollableLabelLargeInner = cScrollableLabelLargeInner( **kwargsInner) super(self.__class__, self).__init__(**RemoveNoClassArgs(kwargs, Widget)) self.oBackGround = None if "background_color" in kwargs: self.oBackGround = cTouchRectangle( size=self.size, pos=self.pos, background_color=kwargs["background_color"]) self.add_widget(self.oBackGround) del kwargs["background_color"] self.oScrollableLabelLargeInner.size = self.size self.oScrollableLabelLargeInner.pos = self.pos self.add_widget(self.oScrollableLabelLargeInner) self.bind(pos=self.update_graphics_pos, size=self.update_graphics_size)
def __init__(self, **kwargs): self.register_event_type('on_release') super(SettingItem, self).__init__(**RemoveNoClassArgs(kwargs, SettingString)) value = kwargs["info"] self.value = value
def __init__(self, **kwargs): self.register_event_type('on_release') super(SettingItem, self).__init__( **RemoveNoClassArgs(dInArgs=kwargs, oObject=SettingString)) uValue: str = kwargs["info"] self.value = uValue
def __init__(self, **kwargs): #we create a new class on the fly top ass the font args to the creation process, as the view adapter creates without arguments self.cLineLayout = type('cLineLayout', cLineLayoutBase.__bases__, dict(cLineLayoutBase.__dict__)) # passes myself to the embedded class. Not good style but Recycleview limits passing customized parameters self.cLineLayout.oScrollableLabelLargeInner = self self.oOrcaWidget = kwargs.get('ORCAWIDGET', None) # maximal len (in chars) of a single ine of the given text self.iMaxLen = 0 # Setting the scrolltypes / bars for the Recycleview self.scroll_type = ['bars', 'content'] self.scroll_wheel_distance = dp(114) self.bar_width = dp(10) # The original passed Data array self.aData = [] # Internal Flag to distinguish between first show and (re) setting text self.bInit = False # The maximum width of a char self.iMaxCharwidth = 0 # The maximum characters per line self.iMaxCharsPerLine = 0 if "font_size" in kwargs: self.on_font_size(None, kwargs["font_size"]) # Retieving the genuine font propertes of a label to pass only those arguments to the label (removing pos, hints, background colors , etc self.aFontProperties = Label._font_properties + ("background_color", ) # standard font args, if nothing is given self.kwFontArgs = { "halign": "left", "valign": "top", "max_lines": 1, "font_size": 20 } # add / update the font args to be passed to the Label for k in kwargs: if k in self.aFontProperties: self.kwFontArgs[k] = kwargs[k] self.kwFontArgs["font_size"] = self.fFontSize self.kwFontArgs.pop("text", None) # Parameter Flag to disable horizontal scrolling self.bNoXScroll = kwargs.get("noxscroll", False) self.bMarkup = kwargs.get("markup", False) #A dummy label to get th width a the larges character self.oLabel = Label(**RemoveNoClassArgs(self.kwFontArgs, Label)) super(self.__class__, self).__init__(**RemoveNoClassArgs(kwargs, RecycleView)) # This manages the distance between lines self.layout_manager.default_size = ( None, self.oLabel._label.get_extents('W')[1]) #self.layout_manager.default_size = (None, self.fFontSize*1.1) self.layout_manager.orientation = 'vertical' # we need to handle size changes self.bind(size=self.update_size) self.bind(text=self.on_textinner) self.text = kwargs.get("text", "")
def __init__(self,**kwargs): Image.__init__(self,**RemoveNoClassArgs(dInArgs=kwargs,oObject=Image)) cOrcaButtonBehaviour.__init__(self,**kwargs)
def __init__(self, **kwargs): super(SettingColorPicker, self).__init__(**RemoveNoClassArgs(dInArgs=kwargs,oObject=SettingNumeric)) self.newvalue = u'' self.oColorpicker:Union[ColorPicker,None] = None
def __init__(self, **kwargs): Image.__init__(self, **RemoveNoClassArgs(kwargs, Image)) cOrcaButtonBehaviour.__init__(self, **kwargs)
def __init__(self, **kwargs): super(SettingColorPicker, self).__init__(**RemoveNoClassArgs(kwargs, SettingNumeric)) self.newvalue = u'' self.colorpicker = None
def __init__(self, **kw): super(cMultiLineButton, self).__init__(**RemoveNoClassArgs(kw, Button)) self.bind(size=self.setter('text_size'))
def __init__(self, **kwargs): self.bInitComplete = False self.oScrollOptionsPopup = ScrollOptionsPopUp(**kwargs) super(SettingScrollOptions, self).__init__(**RemoveNoClassArgs(kwargs, SettingOptions)) self.bInitComplete = True
def __init__(self, **kw): super().__init__(**RemoveNoClassArgs(dInArgs=kw, oObject=Button)) self.bind(size=self.setter('text_size'))
def __init__(self,**kwargs): Button.__init__(self,**RemoveNoClassArgs(kwargs,Button)) cOrcaButtonBehaviour.__init__(self,**kwargs)