def getUI(self): """get the ui element""" result = Label() skin = sm.getSkin('label', self.asset) result.text_size = sm.getControlSize(skin, self.asset) result.bind(texture_size=self.setter('size')) if self.value: result.text = self.value self.uiEl = result self.prepareUiElement() return result
def getUI(self): result = ToggleButton() if self.value: result.state = 'down' skin = sm.getSkin('led', self.asset) result.background_normal = os.path.join(skin['path'], skin['normal']) result.background_down = os.path.join(skin['path'], skin['down']) result.size = sm.getControlSize(skin, self.asset) result.border = [0, 0, 0, 0] self.uiEl = result self.prepareUiElement() return result
def getUI(self): result = ToggleButton() if self.value: result.state = 'down' skin = sm.getSkin('switch', self.asset) result.background_normal = os.path.join(skin['path'], skin["normal"]) result.background_down = os.path.join(skin['path'], skin["down"]) result.size = sm.getControlSize(skin, self.asset) result.border = 0,0,0,0 self.uiEl = result self.prepareUiElement() result.bind(state=self.state_changed) return result
def getUI(self): result = ToggleButton() if self.value: result.state = 'down' skin = sm.getSkin('switch', self.asset) result.background_normal = os.path.join(skin['path'], skin["normal"]) result.background_down = os.path.join(skin['path'], skin["down"]) result.size = sm.getControlSize(skin, self.asset) result.border = 0, 0, 0, 0 self.uiEl = result self.prepareUiElement() result.bind(state=self.state_changed) return result
def getUI(self): """get the ui element""" result = ProgressBar() skin = sm.getSkin('meter', self.asset) result.size = sm.getControlSize(skin, self.asset) result.min = sm.getMinimum('meter', self.value, self._typeInfo) result.max = sm.getMaximum('meter', self.value, self._typeInfo) if self.value: result.value = self.value self.uiEl = result self.prepareUiElement() return result
def __init__(self, data, **kwargs): self.callback = None self.skinPropertyControls = None # keep a reference to the controls that were added for editing the skin specific properties self.data = data self.tempData = copy.copy( data ) # make a shallow copy of the data object which we will be using to edit. It can load stuff if data.control: self.selectedSkin = sm.getSkin(data.control.controlType, data) self.parentW = None # for new items if self.data.skin and 'size' in self.data.skin: self.currentSize = self.data.skin['size'] super(AssetDialog, self).__init__(**kwargs) if self.data.id: self.loadUIFromAsset()
def getUI(self): """get the ui element""" result = Gauge() skin = sm.getSkin('gauge', self.asset) result.size = sm.getControlSize(skin, self.asset) result.file_gauge = os.path.join(skin['path'], skin['gauge']) result.file_needle = os.path.join(skin['path'], skin['needle']) #self.min = sm.getMinimum('gauge', self.value, self._typeInfo) #self.max = sm.getMaximum('gauge', self.value, self._typeInfo) self.min = 0 #temp fix, gauge needs to be updated so it can handle values better self.max = 100 if self.value: result.value = (self.value / (self.max - self.min)) * 100 # need to convert into % cause the gauge can only process from 0 to 100 self.uiEl = result self.prepareUiElement() return result
def getUI(self): """get the ui element""" if 'enum' in self._typeInfo: result = Spinner() result.values = self._typeInfo['enum'] elif self._typeInfo['type'].lower() == 'boolean': result = Spinner() result.values = ['true', 'false'] else: result = TextInput() if self.value: result.text = self.value.lower() skin = sm.getSkin('text', self.asset) result.size = sm.getControlSize(skin, self.asset) self.uiEl = result self.prepareUiElement() result.bind(text=self.value_changed) return result
def getUI(self): """get the ui element""" result = Gauge() skin = sm.getSkin('gauge', self.asset) result.size = sm.getControlSize(skin, self.asset) result.file_gauge = os.path.join(skin['path'], skin['gauge']) result.file_needle = os.path.join(skin['path'], skin['needle']) #self.min = sm.getMinimum('gauge', self.value, self._typeInfo) #self.max = sm.getMaximum('gauge', self.value, self._typeInfo) self.min = 0 #temp fix, gauge needs to be updated so it can handle values better self.max = 100 if self.value: result.value = ( self.value / (self.max - self.min) ) * 100 # need to convert into % cause the gauge can only process from 0 to 100 self.uiEl = result self.prepareUiElement() return result
def getUI(self): """get the ui element""" result = Slider() #SliderExt() if self.value: result.value = self.value skin = sm.getSkin('slider', self.asset) result.size = sm.getControlSize(skin, self.asset) result.orientation = sm.getVar(skin, self.asset, "orientation") result.min = sm.getMinimum('slider', self.value, self._typeInfo) result.max = sm.getMaximum('slider', self.value, self._typeInfo) result.step = sm.getStep('slider', self._typeInfo) result.show_label = sm.getVar(skin, self.asset, "show_label") result.show_marker = sm.getVar(skin, self.asset, "show_marker") self.uiEl = result self.prepareUiElement() if sm.getVar(skin, self.asset, "send_on_release", False): result.on_dragEnded = self.value_changed # set the callback for when drag ends (self made, so no binding) else: result.bind(value=self.value_changed) return result
def getUI(self): """get the ui element""" result = Knob() if self.value: result.value = self.value skin = sm.getSkin('knob', self.asset) result.size = sm.getControlSize(skin, self.asset) result.knobimg_source = os.path.join(skin['path'], skin["knob"]) result.marker_img = os.path.join(skin['path'], skin['marker']) result.min = sm.getMinimum('knob', self.value, self._typeInfo) result.max = sm.getMaximum('knob', self.value, self._typeInfo) result.step = sm.getStep('knob', self._typeInfo) result.show_label = sm.getVar(skin, self.asset, "show_label", False) result.show_marker = sm.getVar(skin, self.asset, "show_marker", False) self.uiEl = result self.prepareUiElement() if sm.getVar(skin, self.asset, "send_on_release", False): result.on_dragEnded = self.value_changed # set the callback for when drag ends (self made, so no binding) else: result.bind(value=self.value_changed) return result