def CreateProgressBar(uTitle, uMessage, lMax): """ Creates a Progressbar """ if this.oGlobalProgressBar is None: this.oGlobalProgressBar = cProgressBar() this.oGlobalProgressBar.Show(uTitle, uMessage, lMax) else: this.oGlobalProgressBar.ReInit(uTitle, uMessage, lMax) return this.oGlobalProgressBar
def ExecuteActionShowProgressBar(self, oAction): """ WikiDoc:Doc WikiDoc:Context:ActionsDetails WikiDoc:Page:Actions-ShowProgressBar WikiDoc:TOCTitle:showprogressbar = showprogressbar = Shows a progressar popup, updates the progressbar value & bar or closes a progressbar popup * If title and message are given, it creates a new progressbar. * If title is not given, but current is given, it updates the progressbar * If title, message and currrent are not not given, the progressbar is closed <div style="overflow:auto; "> {| class="wikitable" ! align="left" | Attribute ! align="left" | Description |- |string |showprogressbar |- |title |Title of the progressbar-popup |- |message |Message for the progress bar popup |- |current |Current value of the progress bar. Default is 0 |- |max |Maximum value of the progress bar (Minimum is always 0) |}</div> If title is empty, message is empty and current is 0, the the progressbar will be closed A short example: <div style="overflow-x: auto;"><syntaxhighlight lang="xml"> <action name="Show the popup" string="showprogressbar" title="My Title" message="My Message" max="100" /> </syntaxhighlight></div> WikiDoc:End """ self.oEvenDispatcher.LogAction(u'ShowProgressBar', oAction) uTitle = ReplaceVars(oAction.dActionPars.get("title", "")) uMessage = ReplaceVars(oAction.dActionPars.get("message", "")) uCurrent = ReplaceVars(oAction.dActionPars.get("current", "")) lCurrent = ToLong(uCurrent) uMax = ReplaceVars(oAction.dActionPars.get("max", "")) lMax = ToLong(uMax) if uTitle != u'' and lMax != 0: oProgressBar = cProgressBar() oProgressBar.Show(uTitle, uMessage, lMax) self.oEvenDispatcher.aProgressBars.append(oProgressBar) return 0 if len(self.oEvenDispatcher.aProgressBars) == 0: LogError(u'Action: Showprogressbar Failed, no active progressar') return 1 oProgressBar = self.oEvenDispatcher.aProgressBars[-1] if uTitle == u'' and uCurrent != '': oProgressBar.Update(lCurrent, uMessage) return 0 if uTitle == u'' and uMessage == u'' and lCurrent == 0: oProgressBar.ClosePopup() self.oEvenDispatcher.aProgressBars.pop() return 0 LogError( u'Action: Showprogressbar Failed, wrong parameter combination') return 1
def ExecuteActionShowProgressBar(self,oAction): ''' WikiDoc:Doc WikiDoc:Context:ActionsDetails WikiDoc:Page:Actions-ShowProgressBar WikiDoc:TOCTitle:showprogressbar = showprogressbar = Shows a progressar popup, updates the progressbar value & bar or closes a progressbar popup * If title and message are given, it creates a new progressbar. * If title is not given, but current is given, it updates the progressbar * If title, message and currrent are not not given, the progressbar is closed <div style="overflow:auto; "> {| class="wikitable" ! align="left" | Attribute ! align="left" | Description |- |string |showprogressbar |- |title |Title of the progressbar-popup |- |message |Message for the progress bar popup |- |current |Current value of the progress bar. Default is 0 |- |max |Maximum value of the progress bar (Minimum is always 0) |}</div> A short example: <div style="overflow-x: auto;"><syntaxhighlight lang="xml"> <action name="Show the popup" string="showprogressbar" title="My Title" message="My Message" max="100" /> </syntaxhighlight></div> WikiDoc:End ''' self.oEvenDispatcher.LogAction(u'ShowProgressBar',oAction) uTitle = ReplaceVars(oAction.aActionPars.get("title","")) uMessage = ReplaceVars(oAction.aActionPars.get("message","")) uCurrent = oAction.aActionPars.get("current","") lCurrent = ToLong(uCurrent) uMax = oAction.aActionPars.get("max","") lMax = ToLong(uMax) if uTitle!=u'' and lMax!=0: oProgressBar=cProgressBar() oProgressBar.Show(uTitle,uMessage,lMax) self.oEvenDispatcher.aProgressBars.append(oProgressBar) return True if len(self.oEvenDispatcher.aProgressBars)==0: LogError(u'Action: Showprogressbar Failed, no active progressar') return False oProgressBar=self.oEvenDispatcher.aProgressBars[-1] if uTitle==u'' and uCurrent!='': oProgressBar.Update(lCurrent,uMessage) return True if uTitle==u'' and uMessage==u'' and lCurrent==0: oProgressBar.ClosePopup() self.oEvenDispatcher.aProgressBars.pop() return True LogError(u'Action: Showprogressbar Failed, wrong parameter combination')
def Start(self): ''' starts the selection of an IRDB item ''' oContent = BoxLayout(orientation='vertical', spacing='5dp') self.oPopup = Popup(title=ReplaceVars('$lvar(664)'),content=oContent, size_hint=(0.9, 0.9),auto_dismiss=False) self.oBtnBrands = Button(text=ReplaceVars('$lvar(667)')) self.oBtnTypes = Button(text=ReplaceVars('$lvar(668)')) self.oBtnModels = Button(text=ReplaceVars('$lvar(669)')) self.oTextBrands = Label() self.oTextTypes = Label() self.oTextModels = Label() self.oProgressBar = cProgressBar() self.oBtnBrands.bind(on_release=self.On_BtnBrands) self.oBtnTypes.bind(on_release=self.On_BtnTypes) self.oBtnModels.bind(on_release=self.On_BtnModels) # construct the content, widget are used as a spacer #Gridlayout is working properly after adding into a box layout oContent.add_widget(Widget(height='2dp', size_hint_y=None)) oContentBrands = BoxLayout(orientation='horizontal', spacing='5dp', height='40dp',size_hint_y=None) oContentBrands.add_widget(self.oBtnBrands) oContentBrands.add_widget(self.oTextBrands) oContentTypes = BoxLayout(orientation='horizontal', spacing='5dp' , height='40dp',size_hint_y=None) oContentTypes.add_widget(self.oBtnTypes) oContentTypes.add_widget(self.oTextTypes) oContentModels = BoxLayout(orientation='horizontal', spacing='5dp' , height='40dp',size_hint_y=None) oContentModels.add_widget(self.oBtnModels) oContentModels.add_widget(self.oTextModels) oContent.add_widget(oContentBrands) oContent.add_widget(oContentTypes) oContent.add_widget(oContentModels) oContent.add_widget(SettingSpacer()) oContent.add_widget(Label(text=ReplaceVars("$lvar(713)"),height='20dp', size_hint_y=None)) oBoxCred = BoxLayout( spacing='5dp',height='30dp',size_hint_y=None) LOGIN_EMAIL = GetEnvVar('IRDBUSER') PASSWORD = GetEnvVar('IRDBPASSWORD') self.oTxtMail = TextInput(text=Var_Load('ITach_Mail','iTach Mail','')) if LOGIN_EMAIL!='': self.oTxtMail.text=LOGIN_EMAIL oBoxCred.add_widget(self.oTxtMail) self.oTxtPassword = TextInput(text=Var_Load('ITach_Password','iTach Password','')) if PASSWORD!='': self.oTxtPassword.text=PASSWORD oBoxCred.add_widget(self.oTxtPassword ) oContent.add_widget(oBoxCred) oContent.add_widget(SettingSpacer()) self.oCodesetName = TextInput(height='20dp') oContent.add_widget(self.oCodesetName) oContent.add_widget(SettingSpacer()) # 2 buttons are created for accept or cancel the current value oBtnButtons = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp') oBtn = Button(text=ReplaceVars('$lvar(5008)')) oBtn.bind (on_release=self.On_BtnLoad) oBtnButtons.add_widget(oBtn) oBtn = Button(text=ReplaceVars('$lvar(5009)')) oBtn.bind(on_release=self.oPopup.dismiss) oBtnButtons.add_widget(oBtn) oContent.add_widget(oBtnButtons) self.oPopup.open() self.CreateCodesetFileName()
def Start(self, uHost: str, uUser: str, uPassword: str) -> None: """ starts the selection of an IRDB item """ self.uPassword = uPassword self.uUser = uUser self.uHost = uHost oContent = BoxLayout(orientation='vertical', spacing='5dp') self.oPopup = Popup( title=ReplaceVars('$lvar(SCRIPT_TOOLS_IRDBITACH_4)'), content=oContent, size_hint=(0.9, 0.9), auto_dismiss=False) self.oBtnBrands = Button( text=ReplaceVars('$lvar(SCRIPT_TOOLS_IRDBITACH_6)')) self.oBtnTypes = Button( text=ReplaceVars('$lvar(SCRIPT_TOOLS_IRDBITACH_7)')) self.oBtnModels = Button( text=ReplaceVars('$lvar(SCRIPT_TOOLS_IRDBITACH_8)')) self.oTextBrands = Label() self.oTextTypes = Label() self.oTextModels = Label() self.oProgressBar = cProgressBar() self.oBtnBrands.bind(on_release=self.On_BtnBrands) self.oBtnTypes.bind(on_release=self.On_BtnTypes) self.oBtnModels.bind(on_release=self.On_BtnModels) # construct the content, widget are used as a spacer #Gridlayout is working properly after adding into a box layout oContent.add_widget(Widget(height='2dp', size_hint_y=None)) oContentBrands = BoxLayout(orientation='horizontal', spacing='5dp', height='40dp', size_hint_y=None) oContentBrands.add_widget(self.oBtnBrands) oContentBrands.add_widget(self.oTextBrands) oContentTypes = BoxLayout(orientation='horizontal', spacing='5dp', height='40dp', size_hint_y=None) oContentTypes.add_widget(self.oBtnTypes) oContentTypes.add_widget(self.oTextTypes) oContentModels = BoxLayout(orientation='horizontal', spacing='5dp', height='40dp', size_hint_y=None) oContentModels.add_widget(self.oBtnModels) oContentModels.add_widget(self.oTextModels) oContent.add_widget(oContentBrands) oContent.add_widget(oContentTypes) oContent.add_widget(oContentModels) if self.uUser == u'' or self.uPassword == u'': oContent.add_widget(SettingSpacer()) oContent.add_widget( Label(text=ReplaceVars("$lvar(SCRIPT_TOOLS_IRDBITACH_5)"), height='20dp', size_hint_y=None)) oContent.add_widget(SettingSpacer()) self.oCodesetName = TextInput(height='20dp') oContent.add_widget(self.oCodesetName) oContent.add_widget(SettingSpacer()) oContentWriteCCF = BoxLayout(orientation='horizontal', spacing='5dp', height='20dp', size_hint_y=None) self.oOptionWriteCCF = CheckBox(active=True) oContentWriteCCF.add_widget( Label(text=ReplaceVars("$lvar(SCRIPT_TOOLS_IRDBITACH_9)"), height='20dp', size_hint_y=None, halign='left')) oContentWriteCCF.add_widget(self.oOptionWriteCCF) oContent.add_widget(oContentWriteCCF) oContentWriteITach = BoxLayout(orientation='horizontal', spacing='5dp', height='20dp', size_hint_y=None) self.oOptionWriteITach = CheckBox() oContentWriteITach.add_widget( Label(text=ReplaceVars("$lvar(SCRIPT_TOOLS_IRDBITACH_10)"), height='20dp', size_hint_y=None, halign='left')) oContentWriteITach.add_widget(self.oOptionWriteITach) oContent.add_widget(oContentWriteITach) oContentOptimizeChannelSelect = BoxLayout(orientation='horizontal', spacing='5dp', height='20dp', size_hint_y=None) self.oOptionOptimizeChannelSelect = CheckBox() oContentOptimizeChannelSelect.add_widget( Label(text=ReplaceVars("$lvar(SCRIPT_TOOLS_IRDBITACH_11)"), height='20dp', size_hint_y=None, halign='left')) oContentOptimizeChannelSelect.add_widget( self.oOptionOptimizeChannelSelect) oContent.add_widget(oContentOptimizeChannelSelect) oContent.add_widget(SettingSpacer()) # 2 buttons are created for accept or cancel the current value oBtnButtons = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp') oBtn = Button(text=ReplaceVars('$lvar(5008)')) oBtn.bind(on_release=self.On_BtnLoad) oBtnButtons.add_widget(oBtn) oBtn = Button(text=ReplaceVars('$lvar(5009)')) oBtn.bind(on_release=self.oPopup.dismiss) oBtnButtons.add_widget(oBtn) oContent.add_widget(oBtnButtons) self.oPopup.open() self.CreateCodesetFileName()