Пример #1
0
	def GenerateQuite(self, varDict, output):
		if not self.template:
			wx.messageBox(_("Report template doesn given! Nothing to generate."),
							_("Sampo Framework"), wx.OK|wx.ICON_WARNING)
			return
		self.varDict = varDict
		pass
Пример #2
0
 def GenerateQuite(self, varDict, output):
     if not self.template:
         wx.messageBox(
             _("Report template doesn given! Nothing to generate."),
             _("Sampo Framework"), wx.OK | wx.ICON_WARNING)
         return
     self.varDict = varDict
     pass
Пример #3
0
 def Generate(self, parent):
     if not self.template:
         wx.messageBox(
             _("Report template doesn given! Nothing to generate."),
             _("Sampo Framework"), wx.OK | wx.ICON_WARNING)
         return
     # ask for the vars
     for vName in self.varViews:
         varDef = self.varViews[vName]
         vtype = varDef.attributes.get('type').value.strip()
         vsrc = varDef.attributes.get('src')
         if vsrc:
             vsrc = vsrc.value.strip()
         vprompt = varDef.attributes.get('prompt')
         if vprompt:
             vprompt = vprompt.value.strip()
         vtitle = _('Variable: %s') % vName
         if vtype == 'text':
             dlg = wx.TextEntryDialog(parent, vprompt, vtitle)
             if dlg.ShowModal() == wx.ID_OK:
                 self.varDict[vName] = dlg.GetValue()
         elif vtype == 'yes_no':
             self.varDict[vName] = wx.MessageBox(
                 vprompt, vtitle, wx.YES_NO | wx.ICON_QUESTION)
         elif vtype == 'choice':
             #dlg = wx.SingleChoiceDialog(parent, vprompt, vtitle, self._GenerateList(varDef))
             dlg = choicedlg.ChoiceDialog(
                 parent,
                 msg=vprompt,
                 title=vtitle,
                 choices=self._GenerateList(varDef))
             if dlg.ShowModal() == wx.ID_OK and dlg.Selection > -1:
                 self.varDict[vName] = self.output[dlg.StringSelection]
         elif vtype == 'multichoice':
             choises = self._GenerateList(varDef)
             dlg = wx.MultiChoiceDialog(parent, vprompt, vtitle, choises)
             if dlg.ShowModal() == wx.ID_OK:
                 chl = dlg.Selections
                 self.varDict[vName] = [choises[x] for x in chl]
     # select output method
     outopts = self.output.keys()
     dlg = wx.SingleChoiceDialog(parent,
                                 _("Select output format for this report:"),
                                 _("Report generation"), outopts)
     if dlg.ShowModal() == wx.ID_OK and dlg.Selection > -1:
         format = self.output[dlg.StringSelection]
         wx.MessageBox(dlg.StringSelection, "Reporter")
     # build report
     self._CollectData()
     self._ProduceReport()
     pass
Пример #4
0
	def Generate(self, parent):
		if not self.template:
			wx.messageBox(_("Report template doesn given! Nothing to generate."),
							_("Sampo Framework"), wx.OK|wx.ICON_WARNING)
			return
		# ask for the vars
		for vName in self.varViews:
			varDef = self.varViews[vName]
			vtype = varDef.attributes.get('type').value.strip()
			vsrc = varDef.attributes.get('src')
			if vsrc:
				vsrc = vsrc.value.strip()
			vprompt = varDef.attributes.get('prompt')
			if vprompt:
				vprompt = vprompt.value.strip()
			vtitle = _('Variable: %s') % vName
			if vtype == 'text':
				dlg = wx.TextEntryDialog(parent, vprompt, vtitle)
				if dlg.ShowModal() == wx.ID_OK:
					self.varDict[vName] = dlg.GetValue()
			elif vtype == 'yes_no':
				self.varDict[vName] = wx.MessageBox(vprompt, vtitle, wx.YES_NO|wx.ICON_QUESTION)
			elif vtype == 'choice':
				#dlg = wx.SingleChoiceDialog(parent, vprompt, vtitle, self._GenerateList(varDef))
				dlg = choicedlg.ChoiceDialog(parent, msg=vprompt, title=vtitle, choices=self._GenerateList(varDef))
				if dlg.ShowModal() == wx.ID_OK and dlg.Selection > -1:
					self.varDict[vName] = self.output[dlg.StringSelection]
			elif vtype == 'multichoice':
				choises = self._GenerateList(varDef)
				dlg = wx.MultiChoiceDialog(parent, vprompt, vtitle, choises)
				if dlg.ShowModal() == wx.ID_OK:
					chl = dlg.Selections
					self.varDict[vName] = [choises[x] for x in chl]
		# select output method
		outopts = self.output.keys()
		dlg = wx.SingleChoiceDialog(parent, _("Select output format for this report:"), _("Report generation"), outopts)
		if dlg.ShowModal() == wx.ID_OK and dlg.Selection > -1:
			format = self.output[dlg.StringSelection]
			wx.MessageBox(dlg.StringSelection, "Reporter")
		# build report
		self._CollectData()
		self._ProduceReport()
		pass