class contratos(wx.Frame): def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"Contratos", pos=wx.DefaultPosition, size=wx.Size(640, 542), style=wx.CAPTION | wx.CLOSE_BOX | wx.NO_BORDER | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) self.SetBackgroundColour(wx.Colour(58, 5, 19)) bSizer12 = wx.BoxSizer(wx.VERTICAL) self.m_panel15 = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) self.m_panel15.SetBackgroundColour(wx.Colour(251, 203, 159)) gSizer11 = wx.GridSizer(0, 4, 0, 0) self.m_staticText26 = wx.StaticText(self.m_panel15, wx.ID_ANY, u"Contrato N° : ", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText26.Wrap(-1) gSizer11.Add(self.m_staticText26, 0, wx.ALL, 5) self.NumCtrlc = NumCtrl(self.m_panel15, -1, style=wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB) gSizer11.Add(self.NumCtrlc, 0, wx.ALL, 5) gSizer11.AddSpacer((0, 0), 1, wx.EXPAND, 5) gSizer11.AddSpacer((0, 0), 1, wx.EXPAND, 5) self.m_staticText27 = wx.StaticText(self.m_panel15, wx.ID_ANY, u"Direccion:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText27.Wrap(-1) gSizer11.Add(self.m_staticText27, 0, wx.ALL, 5) m_comboBox5Choices = [] i = 0 while i < len(rcasas): m_comboBox5Choices.append(rcasas[i][1]) i = i + 1 self.m_comboBox5 = wx.ComboBox(self.m_panel15, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, (250, 23), m_comboBox5Choices, 0) gSizer11.Add(self.m_comboBox5, 0, wx.ALL, 5) gSizer11.AddSpacer((0, 0), 1, wx.EXPAND, 5) self.m_button21 = wx.Button(self.m_panel15, wx.ID_ANY, u"BUSCAR", wx.DefaultPosition, wx.DefaultSize, 0) gSizer11.Add(self.m_button21, 0, wx.ALL, 5) self.m_staticText28 = wx.StaticText(self.m_panel15, 3, u"Propietario:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText28.Wrap(-1) gSizer11.Add(self.m_staticText28, 0, wx.ALL, 5) self.m_textCtrl20 = wx.TextCtrl(self.m_panel15, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, (250, 23), 0) self.m_textCtrl20.Enable(False) gSizer11.Add(self.m_textCtrl20, 0, wx.ALL, 5) gSizer11.AddSpacer((0, 0), 1, wx.EXPAND, 5) gSizer11.AddSpacer((0, 0), 1, wx.EXPAND, 5) self.m_staticText29 = wx.StaticText(self.m_panel15, wx.ID_ANY, u"Inquilino:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText29.Wrap(-1) gSizer11.Add(self.m_staticText29, 0, wx.ALL, 5) m_comboBox6Choices = [] i = 0 while i < len(rinq1): m_comboBox6Choices.append(rinq1[i][0]) i = i + 1 self.m_comboBox6 = wx.ComboBox(self.m_panel15, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, (250, 23), m_comboBox6Choices, 0) self.m_comboBox6.Enable(False) gSizer11.Add(self.m_comboBox6, 0, wx.ALL, 5) gSizer11.AddSpacer((0, 0), 1, wx.EXPAND, 5) gSizer11.AddSpacer((0, 0), 1, wx.EXPAND, 5) self.m_staticText31 = wx.StaticText(self.m_panel15, wx.ID_ANY, u"Fecha Inicio:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText31.Wrap(-1) gSizer11.Add(self.m_staticText31, 0, wx.ALL, 5) self.m_datePicker2 = wx.DatePickerCtrl(self.m_panel15, wx.ID_ANY, wx.DefaultDateTime, wx.DefaultPosition, wx.DefaultSize, wx.DP_DEFAULT | wx.DP_DROPDOWN) self.m_datePicker2.Enable(False) gSizer11.Add(self.m_datePicker2, 0, wx.ALL, 5) self.m_staticText32 = wx.StaticText(self.m_panel15, wx.ID_ANY, u"Fecha de Vencimiento", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText32.Wrap(-1) gSizer11.Add(self.m_staticText32, 0, wx.ALL, 5) self.m_datePicker3 = wx.DatePickerCtrl(self.m_panel15, wx.ID_ANY, wx.DefaultDateTime, wx.DefaultPosition, wx.DefaultSize, wx.DP_DROPDOWN) self.m_datePicker3.Enable(False) gSizer11.Add(self.m_datePicker3, 0, wx.ALL, 5) self.m_staticText34 = wx.StaticText(self.m_panel15, wx.ID_ANY, u"Comision:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText34.Wrap(-1) gSizer11.Add(self.m_staticText34, 0, wx.ALL, 5) self.NumCtrl1 = NumCtrl(self.m_panel15, -1, style=wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB) self.NumCtrl1.SetParameters(integerWidth=9) self.NumCtrl1.SetParameters(fractionWidth=2) self.NumCtrl1.SetGroupChar(';') self.NumCtrl1.SetDecimalChar(',') self.NumCtrl1.SetGroupChar('.') self.NumCtrl1.SetMin(0) self.NumCtrl1.SetMax(-1) self.NumCtrl1.SetAllowNegative(False) self.NumCtrl1.SetSelectOnEntry(False) self.NumCtrl1.Enable(False) gSizer11.Add(self.NumCtrl1, 0, wx.ALL, 5) self.m_panel15.SetSizer(gSizer11) self.m_panel15.Layout() gSizer11.Fit(self.m_panel15) bSizer12.Add(self.m_panel15, 1, wx.ALIGN_TOP | wx.ALL, 5) self.m_panel16 = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) self.m_panel16.SetBackgroundColour(wx.Colour(251, 203, 159)) gSizer12 = wx.GridSizer(0, 3, 0, 0) self.m_staticText36 = wx.StaticText(self.m_panel16, wx.ID_ANY, u"Descuentos:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText36.Wrap(-1) gSizer12.Add(self.m_staticText36, 0, wx.ALL, 5) i = 0 m_comboBox7Choices = [] while i < len(rdes1): m_comboBox7Choices.append(rdes1[i][0]) i = i + 1 self.m_comboBox7 = wx.ComboBox(self.m_panel16, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, (250, 23), m_comboBox7Choices, 0) self.m_comboBox7.Enable(False) gSizer12.Add(self.m_comboBox7, 0, wx.ALL, 5) self.NumCtrl2 = NumCtrl(self.m_panel16, -1, style=wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB) self.NumCtrl2.Enable(False) self.NumCtrl2.SetParameters(integerWidth=9) self.NumCtrl2.SetParameters(fractionWidth=2) self.NumCtrl2.SetGroupChar(';') self.NumCtrl2.SetDecimalChar(',') self.NumCtrl2.SetGroupChar('.') self.NumCtrl2.SetMin(0) self.NumCtrl2.SetMax(-1) self.NumCtrl2.SetAllowNegative(False) self.NumCtrl2.SetSelectOnEntry(False) self.NumCtrl2.Enable(False) gSizer12.Add(self.NumCtrl2, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_LEFT | wx.ALL, 5) self.m_checkBox1 = wx.CheckBox(self.m_panel16, wx.ID_ANY, u"Imprime en Propietario", wx.DefaultPosition, wx.DefaultSize, 0) self.m_checkBox1.Enable(False) gSizer12.Add(self.m_checkBox1, 0, wx.ALL, 5) self.m_checkBox2 = wx.CheckBox(self.m_panel16, wx.ID_ANY, u"Imprime en Inmobiliaria", wx.DefaultPosition, wx.DefaultSize, 0) self.m_checkBox2.Enable(False) gSizer12.Add(self.m_checkBox2, 0, wx.ALL, 5) self.m_checkBox3 = wx.CheckBox(self.m_panel16, wx.ID_ANY, u"Imprime en Inquilino", wx.DefaultPosition, wx.DefaultSize, 0) self.m_checkBox3.Enable(False) gSizer12.Add(self.m_checkBox3, 0, wx.ALL, 5) self.m_panel16.SetSizer(gSizer12) self.m_panel16.Layout() gSizer12.Fit(self.m_panel16) bSizer12.Add(self.m_panel16, 1, wx.ALIGN_TOP | wx.ALL | wx.EXPAND, 5) self.m_panel17 = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) self.m_panel17.SetBackgroundColour(wx.Colour(251, 203, 159)) bSizer14 = wx.BoxSizer(wx.VERTICAL) self.m_button24 = wx.Button(self.m_panel17, wx.ID_ANY, u"AGREGAR", wx.DefaultPosition, wx.DefaultSize, 0) self.m_button24.Enable(False) bSizer14.Add(self.m_button24, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.EXPAND, 5) self.m_panel17.SetSizer(bSizer14) self.m_panel17.Layout() bSizer14.Fit(self.m_panel17) bSizer12.Add(self.m_panel17, 1, wx.ALIGN_TOP | wx.ALL | wx.EXPAND, 5) self.m_panel18 = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) self.m_panel18.SetBackgroundColour(wx.Colour(251, 203, 159)) bSizer15 = wx.BoxSizer(wx.VERTICAL) m_listBox1Choices = [] self.m_listBox1 = wx.ListBox(self.m_panel18, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_listBox1Choices, 0) self.m_listBox1.Enable(False) bSizer15.Add(self.m_listBox1, 0, wx.ALIGN_TOP | wx.ALL | wx.EXPAND | wx.TOP, 5) self.m_panel18.SetSizer(bSizer15) self.m_panel18.Layout() bSizer15.Fit(self.m_panel18) bSizer12.Add(self.m_panel18, 1, wx.ALIGN_TOP | wx.ALL | wx.EXPAND, 5) self.m_panel19 = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) self.m_panel19.SetBackgroundColour(wx.Colour(251, 203, 159)) bSizer17 = wx.BoxSizer(wx.VERTICAL) self.m_button25 = wx.Button(self.m_panel19, wx.ID_ANY, u"ELIMINAR", wx.DefaultPosition, wx.DefaultSize, 0) self.m_button25.Enable(False) bSizer17.Add(self.m_button25, 0, wx.ALIGN_TOP | wx.ALL | wx.EXPAND, 5) self.m_panel19.SetSizer(bSizer17) self.m_panel19.Layout() bSizer17.Fit(self.m_panel19) bSizer12.Add(self.m_panel19, 1, wx.ALIGN_TOP | wx.ALL | wx.EXPAND, 5) self.m_panel20 = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) self.m_panel20.SetBackgroundColour(wx.Colour(251, 203, 159)) bSizer18 = wx.BoxSizer(wx.HORIZONTAL) self.m_button26 = wx.Button(self.m_panel20, wx.ID_ANY, u"GUARDAR", wx.DefaultPosition, wx.DefaultSize, 0) self.m_button26.Enable(False) bSizer18.Add(self.m_button26, 0, wx.ALL, 5) self.m_button27 = wx.Button(self.m_panel20, wx.ID_ANY, u"CANCELAR", wx.DefaultPosition, wx.DefaultSize, 0) self.m_button27.Enable(False) bSizer18.Add(self.m_button27, 0, wx.ALIGN_RIGHT | wx.ALL, 5) self.m_panel20.SetSizer(bSizer18) self.m_panel20.Layout() bSizer18.Fit(self.m_panel20) bSizer12.Add(self.m_panel20, 1, wx.ALIGN_CENTER | wx.ALIGN_TOP | wx.ALL, 5) self.SetSizer(bSizer12) self.Layout() self.Centre(wx.BOTH) # Connect Events self.m_button21.Bind(wx.EVT_BUTTON, self.buscar) self.m_button24.Bind(wx.EVT_BUTTON, self.agregar) self.m_button25.Bind(wx.EVT_BUTTON, self.eliminar) self.m_button26.Bind(wx.EVT_BUTTON, self.guardar) self.m_button27.Bind(wx.EVT_BUTTON, self.cancelar) def __del__(self): pass # Virtual event handlers, overide them in your derived class def buscar(self, event): self.m_comboBox6.Enable(True) self.m_datePicker2.Enable(True) self.m_datePicker3.Enable(True) self.NumCtrl1.Enable(True) self.m_comboBox7.Enable(True) self.NumCtrl2.Enable(True) self.m_checkBox1.Enable(True) self.m_checkBox2.Enable(True) self.m_checkBox3.Enable(True) self.m_listBox1.Enable(True) self.m_button24.Enable(True) self.m_button25.Enable(True) self.m_button26.Enable(True) self.m_button27.Enable(True) direccion = self.m_comboBox5.GetValue() Casa2 = Casa('', direccion, '', '', '') regp = Casa2.consultar(con1) self.m_textCtrl20.SetValue(regp[0]) event.Skip() def agregar(self, event): desc = self.m_comboBox7.GetValue() monto = self.NumCtrl2.GetValue() monto = str(monto) if self.m_checkBox1.GetValue() == True: chek1 = "SI" else: chek1 = "NO" if self.m_checkBox2.GetValue() == True: chek2 = "SI" else: chek2 = "NO" if self.m_checkBox3.GetValue() == True: chek3 = "SI" else: chek3 = "NO" self.m_listBox1.Append(desc + " ," + monto + "," + chek1 + "," + chek2 + "," + chek3) event.Skip() def eliminar(self, event): sel = self.m_listBox1.GetSelection() if sel != -1: self.m_listBox1.Delete(sel) event.Skip() def guardar(self, event): for i in range(self.m_listBox1.GetCount()): a = self.m_listBox1.GetString(i) lista = a.split(',') descripcion = lista[0] descuento1 = Descuentos('', descripcion) rd = descuento1.consultar(con1) monto = lista[1] monto = monto[0:len(monto)] impripro = lista[2] impripro = impripro[0:len(impripro)] imprinmo = lista[3] imprinmo = imprinmo[0:len(imprinmo)] imprinq = lista[4] imprinq = imprinq[0:len(imprinq)] ncontrato = self.NumCtrlc.GetValue() comision = self.NumCtrl1.GetValue() direccion = self.m_comboBox5.GetValue() propietario = self.m_textCtrl20.GetValue() inquilinos = self.m_comboBox6.GetValue() seleccion1 = self.m_datePicker2.GetValue() mes1 = 1 + seleccion1.Month mes = str(mes1) dia = str(seleccion1.Day) ano = str(seleccion1.Year) fechain = dia + "/" + mes + "/" + ano fechain = str(fechain) seleccion2 = self.m_datePicker3.GetValue() mes1 = seleccion2.Month + 1 mes = str(mes1) dia = str(seleccion2.Day) ano = str(seleccion2.Year) fechavto = dia + "/" + mes + "/" + ano fechavto = str(fechavto) cont1 = Contrato(ncontrato, direccion, inquilinos, fechain, fechavto, propietario, comision) cont1.agregar(con1, descripcion, monto, impripro, imprinmo, imprinq, rd[1]) Casa1.direccion = self.m_comboBox5.GetValue() Casa1.contrato = self.NumCtrlc.GetValue() Casa1.alquilar(con1) self.Destroy() def cancelar(self, event): self.Destroy() event.Skip()
class SecondSystemDialog(wx.Dialog): def __init__(self, parent, id, flag=None): #flag es una variable que indica si el calculo es de caida de presion o de diametro self.prevReturnCode = None self.systemValues = {} wx.Dialog.__init__(self, parent, id, self.secondSystemDialogGeneralText()["c1"], size=(460, 350)) self.panel = wx.Panel(self, -1) vbox = wx.BoxSizer(wx.VERTICAL) firstList = self.secondSystemDialogGeneralText()["c2"] self.radioBox1 = wx.RadioBox(self.panel, -1, self.secondSystemDialogGeneralText()["c3"], (50, 10), (100, 70), firstList, 1, wx.RA_SPECIFY_COLS) secondList = self.secondSystemDialogGeneralText()["c4"] self.radioBox2 = wx.RadioBox(self.panel, -1, self.secondSystemDialogGeneralText()["c5"], (300, 10), (100, 70), secondList, 2, wx.RA_SPECIFY_COLS) ### flow label value and units self.flowLabel = wx.StaticText(self.panel, -1, self.secondSystemDialogGeneralText()["c6"], pos=(10, 94)) self.flowValue = NumCtrl(self.panel, -1, pos=(10, 110), integerWidth = 7, fractionWidth = 2) self.flowValue.SetMin(0.01) self.flowValue.SetValue(0.01) flowUnitList = self.secondSystemDialogGeneralText()["c7"] self.flowUnit = wx.Choice(self.panel, -1, (115, 110), choices=flowUnitList) ### temperature label value and units self.temperatureLabel = wx.StaticText(self.panel, -1, self.secondSystemDialogGeneralText()["c8"], pos=(10, 140)) self.temperatureValue = NumCtrl(self.panel, -1, pos=(10, 156), integerWidth = 7, fractionWidth = 2)#, SetMin=0.01, SetMax=373.94) self.temperatureValue.SetMin(0.01) self.temperatureValue.SetMax(373.94) self.temperatureValue.SetLimitOnFieldChange(True) self.temperatureValue.SetValue(0.01) temperatureUnitList = self.secondSystemDialogGeneralText()["c9"] self.temperatureUnit = wx.Choice(self.panel, -1, (115, 156), choices=temperatureUnitList) self.temperatureUnit.Bind(wx.EVT_CHOICE, self.onTemperatureUnitChange) ### density label value and units self.densityLabel = wx.StaticText(self.panel, -1, self.secondSystemDialogGeneralText()["c10"], pos=(10, 186)) self.densityValue = NumCtrl(self.panel, -1, pos=(10, 202), integerWidth = 4, fractionWidth = 2) self.densityValue.SetMin(0.01) self.densityValue.SetValue(0.01) densityUnitList = self.secondSystemDialogGeneralText()["c11"] self.densityUnit = wx.Choice(self.panel, -1, (115, 202), choices=densityUnitList) self.densityLabel.Enable(False) self.densityUnit.Enable(False) self.densityValue.Enable(False) ### viscosity label value and units self.viscosityLabel = wx.StaticText(self.panel, -1, self.secondSystemDialogGeneralText()["c12"], pos=(10, 228)) self.viscosityValue = NumCtrl(self.panel, -1, pos=(10, 244), integerWidth = 3, fractionWidth = 7) self.viscosityValue.SetMin(0.0000001) self.viscosityValue.SetValue(0.0000001) viscosityUnitList = self.secondSystemDialogGeneralText()["c13"] self.viscosityUnit = wx.Choice(self.panel, -1, (115, 244), choices=viscosityUnitList) self.viscosityLabel.Enable(False) self.viscosityUnit.Enable(False) self.viscosityValue.Enable(False) ### roughness label value and units self.roughnessLabel = wx.StaticText(self.panel, -1, self.secondSystemDialogGeneralText()["c14"], pos=(260, 94)) self.roughnessValue = NumCtrl(self.panel, -1, pos=(260, 110), integerWidth = 1, fractionWidth = 7) self.roughnessValue.SetMin(0.0000001) self.roughnessValue.SetValue(0.0000001) roughnessUnitList = self.secondSystemDialogGeneralText()["c15"] self.roughnessUnit = wx.Choice(self.panel, -1, (345, 110), choices=roughnessUnitList) self.roughnessLabel.Enable(False) self.roughnessUnit.Enable(False) self.roughnessValue.Enable(False) ### pressure drop label value and units self.pressureDropLabel = wx.StaticText(self.panel, -1, self.secondSystemDialogGeneralText()["c23"], pos=(260, 140)) self.pressureDropValue = NumCtrl(self.panel, -1, pos=(260, 156), integerWidth = 7, fractionWidth = 3) self.pressureDropValue.SetMin(0.01) self.pressureDropValue.SetValue(0.01) pressureDropUnitList = self.secondSystemDialogGeneralText()["c24"] self.pressureDropUnit = wx.Choice(self.panel, -1, (370, 156), choices=pressureDropUnitList) if flag: self.pressureDropLabel.Enable(True) self.pressureDropUnit.Enable(True) self.pressureDropValue.Enable(True) else: self.pressureDropLabel.Enable(False) self.pressureDropUnit.Enable(False) self.pressureDropValue.Enable(False) self.radioBox1.Bind(wx.EVT_RADIOBOX, self.onRadioBox1) self.radioBox2.Bind(wx.EVT_RADIOBOX, self.onRadioBox2) hbox = wx.BoxSizer(wx.HORIZONTAL) self.prevButton = wx.Button(self, -1, self.secondSystemDialogGeneralText()["c16"], size=(70, 30)) self.cancelButton = wx.Button(self, -1, self.secondSystemDialogGeneralText()["c17"], size=(70, 30)) self.nextButton = wx.Button(self, -1, self.secondSystemDialogGeneralText()["c18"], size=(70, 30)) self.prevButton.Bind(wx.EVT_BUTTON, self.onPrev) self.cancelButton.Bind(wx.EVT_BUTTON, self.onCancel) self.nextButton.Bind(wx.EVT_BUTTON, self.onNext) hbox.Add(self.prevButton, 1 ) hbox.Add(self.nextButton, 1, wx.LEFT, 5) hbox.Add(self.cancelButton, 1, wx.LEFT, 5) vbox.Add(self.panel) vbox.Add(hbox, 1, wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, 10) self.SetSizer(vbox) self.nextButton.SetDefault() #set the nextButton as default self.Bind(wx.EVT_CLOSE, self.onCancel) #bind the window close icon on the top right corner of the window def onTemperatureUnitChange(self, evt): unitSelected = self.temperatureUnit.GetStringSelection() if unitSelected == "F": self.temperatureValue.SetMin(32.02) self.temperatureValue.SetMax(705.1) self.temperatureValue.SetValue(32.02) elif unitSelected == "C": self.temperatureValue.SetMin(0.01) self.temperatureValue.SetMax(373.94) self.temperatureValue.SetValue(0.01) pass def onRadioBox1(self, evt): selected = self.radioBox1.GetSelection() if selected == 0: self.densityLabel.Enable(False) self.densityUnit.Enable(False) self.densityValue.Enable(False) self.viscosityLabel.Enable(False) self.viscosityUnit.Enable(False) self.viscosityValue.Enable(False) self.temperatureLabel.Enable() self.temperatureUnit.Enable() self.temperatureValue.Enable() elif selected == 1: self.temperatureLabel.Enable(False) self.temperatureUnit.Enable(False) self.temperatureValue.Enable(False) self.densityLabel.Enable() self.densityUnit.Enable() self.densityValue.Enable() self.viscosityLabel.Enable() self.viscosityUnit.Enable() self.viscosityValue.Enable() else: pass def onRadioBox2(self, evt): selected = self.radioBox2.GetSelection() if (selected == 0 or selected == 1 or selected == 2): self.roughnessLabel.Enable(False) self.roughnessUnit.Enable(False) self.roughnessValue.Enable(False) elif selected == 3: self.roughnessLabel.Enable() self.roughnessUnit.Enable() self.roughnessValue.Enable() else: pass def onCancel(self, evt): self.EndModal(wx.ID_CANCEL) def onPrev(self, evt): self.prevReturnCode = wx.NewId() self.EndModal(self.prevReturnCode) def onNext(self, evt): radioBox1Selection = self.radioBox1.GetSelection() radioBox2Selection = self.radioBox2.GetSelection() okToClose = [False, False, False] #begin segmento para la caida de presion if self.pressureDropValue.IsEnabled(): #si el calculo es para diametro minimo if self.pressureDropUnit.GetSelection() == -1: #si no se ha especificado valor en las unidades de caida de presion dialog = wx.MessageDialog(self.panel, self.secondSystemDialogGeneralText()["c25"], self.secondSystemDialogGeneralText()["c26"], style=wx.OK | wx.ICON_EXCLAMATION) dialog.ShowModal() dialog.Destroy() okToClose[2] = False else: self.systemValues["pressure_drop"] = self.pressureDropValue.GetValue() self.systemValues["pressure_drop_unit"] = self.pressureDropUnit.GetStringSelection() okToClose[2] = True #end segmento para la caida de presion if radioBox1Selection == 0: if (self.flowUnit.GetSelection() == -1 or self.temperatureUnit.GetSelection() == -1): dialog = wx.MessageDialog(self.panel, self.secondSystemDialogGeneralText()["c19"], self.secondSystemDialogGeneralText()["c20"], style=wx.OK | wx.ICON_EXCLAMATION) dialog.ShowModal() dialog.Destroy() okToClose[0] = False else: self.systemValues["water"] = "yes" self.systemValues["flow"] = self.flowValue.GetValue() self.systemValues["flow_unit"] = self.flowUnit.GetStringSelection() self.systemValues["temperature"] = self.temperatureValue.GetValue() self.systemValues["temperature_unit"] = self.temperatureUnit.GetStringSelection() okToClose[0] = True elif radioBox1Selection == 1: if (self.flowUnit.GetSelection() == -1 or self.viscosityUnit.GetSelection() == -1 or self.densityUnit.GetSelection() == -1): dialog = wx.MessageDialog(self.panel, self.secondSystemDialogGeneralText()["c21"], self.secondSystemDialogGeneralText()["c20"], style=wx.OK | wx.ICON_EXCLAMATION) dialog.ShowModal() dialog.Destroy() okToClose[0] = False else: self.systemValues["water"] = "None" self.systemValues["flow"] = self.flowValue.GetValue() self.systemValues["flow_unit"] = self.flowUnit.GetStringSelection() self.systemValues["viscosity"] = self.viscosityValue.GetValue() self.systemValues["viscosity_unit"] = self.viscosityUnit.GetStringSelection() self.systemValues["density"] = self.densityValue.GetValue() self.systemValues["density_unit"] = self.densityUnit.GetStringSelection() okToClose[0] = True if radioBox2Selection == 0: self.systemValues["pipe_type"] = "CSP" okToClose[1] = True elif radioBox2Selection == 1: self.systemValues["pipe_type"] = "SSP" okToClose[1] = True elif radioBox2Selection == 2: self.systemValues["pipe_type"] = "PVC" okToClose[1] = True elif radioBox2Selection == 3: self.systemValues["pipe_type"] = "None" if self.roughnessUnit.GetSelection() == -1: dialog = wx.MessageDialog(self.panel, self.secondSystemDialogGeneralText()["c22"], self.secondSystemDialogGeneralText()["c20"], style=wx.OK | wx.ICON_EXCLAMATION) dialog.ShowModal() dialog.Destroy() okToClose[1] = False else: self.systemValues["roughness"] = self.roughnessValue.GetValue() self.systemValues["roughness_unit"] = self.roughnessUnit.GetStringSelection() okToClose[1] = True if self.pressureDropValue.IsEnabled(): if okToClose[0] and okToClose[1] and okToClose[2]: # print self.systemValues self.EndModal(wx.ID_OK) else: if okToClose[0] and okToClose[1]: # print self.systemValues self.EndModal(wx.ID_OK) def secondSystemDialogGeneralText(self): text = Language() return text.secondSystemDialogGeneralText()
class concam ( wx.Frame ): def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Consulta de Cotrantos", pos = wx.DefaultPosition, size = wx.Size( 580,548 ), style = wx.CAPTION|wx.CLOSE_BOX|wx.NO_BORDER|wx.TAB_TRAVERSAL ) self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOWFRAME ) ) bSizer12 = wx.BoxSizer( wx.VERTICAL ) self.m_panel15 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.m_panel15.SetBackgroundColour( wx.Colour( 181, 249, 162 ) ) gSizer11 = wx.GridSizer( 0, 4, 0, 0 ) self.m_staticText26 = wx.StaticText( self.m_panel15, wx.ID_ANY, u"Contrato N° : ", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText26.Wrap( -1 ) gSizer11.Add( self.m_staticText26, 0, wx.ALL, 5 ) self.NumCtrlc = NumCtrl(self.m_panel15,-1,style=wx.TE_PROCESS_ENTER|wx.TE_PROCESS_TAB) gSizer11.Add( self.NumCtrlc, 0, wx.ALL, 5 ) self.m_button21 = wx.Button( self.m_panel15, wx.ID_ANY, u"BUSCAR", wx.DefaultPosition, wx.DefaultSize, 0 ) gSizer11.Add( self.m_button21, 0, wx.ALL, 5 ) gSizer11.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.m_staticText27 = wx.StaticText( self.m_panel15, wx.ID_ANY, u"Direccion:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText27.Wrap( -1 ) gSizer11.Add( self.m_staticText27, 0, wx.ALL, 5 ) self.m_textCtrl32 = wx.TextCtrl( self.m_panel15, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, (250, 23), 0 ) self.m_textCtrl32.Enable( False ) gSizer11.Add( self.m_textCtrl32, 0, wx.ALL, 5 ) gSizer11.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) gSizer11.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.m_staticText28 = wx.StaticText( self.m_panel15, 3, u"Propietario:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText28.Wrap( -1 ) gSizer11.Add( self.m_staticText28, 0, wx.ALL, 5 ) self.m_textCtrl20 = wx.TextCtrl( self.m_panel15, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, (250, 23), 0 ) self.m_textCtrl20.Enable( False ) gSizer11.Add( self.m_textCtrl20, 0, wx.ALL, 5 ) gSizer11.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) gSizer11.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.m_staticText29 = wx.StaticText( self.m_panel15, wx.ID_ANY, u"Inquilino:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText29.Wrap( -1 ) gSizer11.Add( self.m_staticText29, 0, wx.ALL, 5 ) self.m_textCtrl33 = wx.TextCtrl( self.m_panel15, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, (250, 23), 0 ) gSizer11.Add( self.m_textCtrl33, 0, wx.ALL, 5 ) self.m_textCtrl33.Enable(False) gSizer11.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) gSizer11.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) self.m_staticText31 = wx.StaticText( self.m_panel15, wx.ID_ANY, u"Fecha Inicio:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText31.Wrap( -1 ) gSizer11.Add( self.m_staticText31, 0, wx.ALL, 5 ) self.m_textCtrl26 = wx.TextCtrl( self.m_panel15, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) gSizer11.Add( self.m_textCtrl26, 0, wx.ALL, 5 ) self.m_textCtrl26.Enable(False) self.m_staticText32 = wx.StaticText( self.m_panel15, wx.ID_ANY, u"Fecha de Vencimiento", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText32.Wrap( -1 ) gSizer11.Add( self.m_staticText32, 0, wx.ALL, 5 ) self.m_textCtrl27 = wx.TextCtrl( self.m_panel15, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) gSizer11.Add( self.m_textCtrl27, 0, wx.ALL, 5 ) self.m_textCtrl27.Enable(False) self.m_staticText34 = wx.StaticText( self.m_panel15, wx.ID_ANY, u"Comision:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText34.Wrap( -1 ) gSizer11.Add( self.m_staticText34, 0, wx.ALL, 5 ) self.NumCtrl3 = NumCtrl(self.m_panel15,-1,style=wx.TE_PROCESS_ENTER|wx.TE_PROCESS_TAB) self.NumCtrl3.Enable( False ) self.NumCtrl3.SetParameters( integerWidth = 9) self.NumCtrl3.SetParameters( fractionWidth = 2) self.NumCtrl3.SetGroupChar(';') self.NumCtrl3.SetDecimalChar(',') self.NumCtrl3.SetGroupChar('.') self.NumCtrl3.SetMin(0) self.NumCtrl3.SetMax(-1) self.NumCtrl3.SetAllowNegative(False) self.NumCtrl3.SetSelectOnEntry(False) self.NumCtrl3.Enable( False ) gSizer11.Add( self.NumCtrl3, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_LEFT|wx.ALL, 5 ) self.m_panel15.SetSizer( gSizer11 ) self.m_panel15.Layout() gSizer11.Fit( self.m_panel15 ) bSizer12.Add( self.m_panel15, 1, wx.ALIGN_TOP|wx.ALL, 5 ) self.m_panel16 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.m_panel16.SetBackgroundColour( wx.Colour( 181, 249, 162 ) ) gSizer12 = wx.GridSizer( 0, 3, 0, 0 ) self.m_staticText36 = wx.StaticText( self.m_panel16, wx.ID_ANY, u"Descuentos:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText36.Wrap( -1 ) gSizer12.Add( self.m_staticText36, 0, wx.ALL, 5 ) a=0 m_comboBox7Choices = [] while a < len(rdes1): m_comboBox7Choices.append(rdes1[a][0]) a = a + 1 self.m_comboBox7 = wx.ComboBox( self.m_panel16, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_comboBox7Choices, 0 ) self.m_comboBox7.Enable( False ) gSizer12.Add( self.m_comboBox7, 0, wx.ALL, 5 ) self.NumCtrl2 = NumCtrl(self.m_panel16,-1,style=wx.TE_PROCESS_ENTER|wx.TE_PROCESS_TAB) self.NumCtrl2.Enable( False ) self.NumCtrl2.SetParameters( integerWidth = 9) self.NumCtrl2.SetParameters( fractionWidth = 2) self.NumCtrl2.SetGroupChar(';') self.NumCtrl2.SetDecimalChar(',') self.NumCtrl2.SetGroupChar('.') self.NumCtrl2.SetMin(0) self.NumCtrl2.SetMax(-1) self.NumCtrl2.SetAllowNegative(False) self.NumCtrl2.SetSelectOnEntry(False) self.NumCtrl2.Enable( False ) gSizer12.Add( self.NumCtrl2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_LEFT|wx.ALL, 5 ) self.m_checkBox1 = wx.CheckBox( self.m_panel16, wx.ID_ANY, u"Imprime en Propietario", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_checkBox1.Enable( False ) gSizer12.Add( self.m_checkBox1, 0, wx.ALL, 5 ) self.m_checkBox2 = wx.CheckBox( self.m_panel16, wx.ID_ANY, u"Imprime en Inmobiliaria", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_checkBox2.Enable( False ) gSizer12.Add( self.m_checkBox2, 0, wx.ALL, 5 ) self.m_checkBox3 = wx.CheckBox( self.m_panel16, wx.ID_ANY, u"Imprime en Inquilino", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_checkBox3.Enable( False ) gSizer12.Add( self.m_checkBox3, 0, wx.ALL, 5 ) self.m_panel16.SetSizer( gSizer12 ) self.m_panel16.Layout() gSizer12.Fit( self.m_panel16 ) bSizer12.Add( self.m_panel16, 1, wx.ALIGN_TOP|wx.ALL|wx.EXPAND, 5 ) self.m_panel17 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.m_panel17.SetBackgroundColour( wx.Colour( 184, 249, 162 ) ) bSizer14 = wx.BoxSizer( wx.VERTICAL ) self.m_button24 = wx.Button( self.m_panel17, wx.ID_ANY, u"AGREGAR", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_button24.Enable( False ) bSizer14.Add( self.m_button24, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 ) self.m_panel17.SetSizer( bSizer14 ) self.m_panel17.Layout() bSizer14.Fit( self.m_panel17 ) bSizer12.Add( self.m_panel17, 1, wx.ALIGN_TOP|wx.ALL|wx.EXPAND, 5 ) self.m_panel18 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.m_panel18.SetBackgroundColour( wx.Colour( 191, 255, 162 ) ) bSizer15 = wx.BoxSizer( wx.VERTICAL ) m_listBox1Choices = [] self.m_listBox1 = wx.ListBox( self.m_panel18, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_listBox1Choices, 0 ) self.m_listBox1.Enable( False ) bSizer15.Add( self.m_listBox1, 0, wx.ALIGN_TOP|wx.ALL|wx.EXPAND|wx.TOP, 5 ) self.m_panel18.SetSizer( bSizer15 ) self.m_panel18.Layout() bSizer15.Fit( self.m_panel18 ) bSizer12.Add( self.m_panel18, 1, wx.ALIGN_TOP|wx.ALL|wx.EXPAND, 5 ) self.m_panel19 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.m_panel19.SetBackgroundColour( wx.Colour( 181, 255, 162 ) ) bSizer17 = wx.BoxSizer( wx.VERTICAL ) self.m_button25 = wx.Button( self.m_panel19, wx.ID_ANY, u"ELIMINAR", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_button25.Enable( False ) bSizer17.Add( self.m_button25, 0, wx.ALIGN_TOP|wx.ALL|wx.EXPAND, 5 ) self.m_panel19.SetSizer( bSizer17 ) self.m_panel19.Layout() bSizer17.Fit( self.m_panel19 ) bSizer12.Add( self.m_panel19, 1, wx.ALIGN_TOP|wx.ALL|wx.EXPAND, 5 ) self.m_panel20 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.m_panel20.SetBackgroundColour( wx.Colour( 181, 255, 162 ) ) bSizer18 = wx.BoxSizer( wx.HORIZONTAL ) self.m_button53 = wx.Button( self.m_panel20, wx.ID_ANY, u"EDITAR CONTRATO", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_button53.Enable( False ) bSizer18.Add( self.m_button53, 0, wx.ALL, 5 ) self.m_button54 = wx.Button( self.m_panel20, wx.ID_ANY, u"ELIMINAR CONTRATO", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_button54.Enable( False ) bSizer18.Add( self.m_button54, 0, wx.ALL, 5 ) self.m_button26 = wx.Button( self.m_panel20, wx.ID_ANY, u"GUARDAR", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_button26.Enable( False ) self.m_button26.Hide() bSizer18.Add( self.m_button26, 0, wx.ALL, 5 ) self.m_button27 = wx.Button( self.m_panel20, wx.ID_ANY, u"CANCELAR", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_button27.Enable( False ) self.m_button27.Hide() bSizer18.Add( self.m_button27, 0, wx.ALIGN_RIGHT|wx.ALL, 5 ) self.m_panel20.SetSizer( bSizer18 ) self.m_panel20.Layout() bSizer18.Fit( self.m_panel20 ) bSizer12.Add( self.m_panel20, 1, wx.ALIGN_CENTER|wx.ALIGN_TOP|wx.ALL, 5 ) self.SetSizer( bSizer12 ) self.Layout() self.Centre( wx.BOTH ) # Connect Events self.m_button21.Bind( wx.EVT_BUTTON, self.buscar ) self.m_button24.Bind( wx.EVT_BUTTON, self.agregar ) self.m_button25.Bind( wx.EVT_BUTTON, self.eliminar ) self.m_button53.Bind( wx.EVT_BUTTON, self.edcontrato ) self.m_button54.Bind( wx.EVT_BUTTON, self.eliminarcontrato ) def __del__( self ): pass # Virtual event handlers, overide them in your derived class def buscar( self, event ): cont1.numero=str(self.NumCtrlc.GetValue()) a=cont1.consultar(con1) if len(a)==0: wx.MessageBox('Este contrato no existe', 'Info', wx.OK | wx.ICON_INFORMATION) else: self.NumCtrlc.Enable(False) self.m_button21.Enable(False) self.m_button53.Enable(True) self.m_button54.Enable(True) for i in range (len(a)): descuento=a[i][1] monto=str(a[i][10]) imprimep=a[i][7] imprimei=a[i][8] imprimeinq=a[i][9] self.m_listBox1.Append(descuento + " ,"+monto + "," + imprimep + ","+ imprimei + ","+ imprimeinq ) self.m_textCtrl26.Enable(True) self.m_textCtrl27.Enable(True) self.NumCtrl3.Enable(True) self.m_comboBox7.Enable(True) self.NumCtrl2.Enable(True) self.m_checkBox1.Enable(True) self.m_checkBox2.Enable(True) self.m_checkBox3.Enable(True) self.m_button24.Enable(True) self.m_listBox1.Enable(True) self.m_button25.Enable(True) self.m_textCtrl32.SetValue(a[0][2]) self.m_textCtrl20.SetValue(a[0][6]) self.m_textCtrl33.SetValue(a[0][3]) self.m_textCtrl26.SetValue(a[0][4]) self.m_textCtrl27.SetValue(a[0][5]) self.NumCtrl3.SetValue(a[0][11]) event.Skip() def agregar( self, event ): desc=self.m_comboBox7.GetValue() monto=self.NumCtrl2.GetValue() monto=str(monto) if self.m_checkBox1.GetValue()==True: chek1="SI" else: chek1="NO" if self.m_checkBox2.GetValue()==True: chek2="SI" else: chek2="NO" if self.m_checkBox3.GetValue()==True: chek3="SI" else: chek3="NO" self.m_listBox1.Append(desc + " ,"+monto + "," + chek1 + ","+ chek2 + ","+ chek3 ) event.Skip() def eliminar( self, event ): sel = self.m_listBox1.GetSelection() if sel != -1: self.m_listBox1.Delete(sel) event.Skip() def edcontrato( self, event ): cont1.direccion=self.m_textCtrl32.GetValue() cont1.inquilinos=self.m_textCtrl33.GetValue() cont1.fechain=self.m_textCtrl26.GetValue() cont1.fechavto=self.m_textCtrl27.GetValue() cont1.propietario=self.m_textCtrl20.GetValue() cont1.comision=self.NumCtrl3.GetValue() cont1.eliminar(con1) for i in range(self.m_listBox1.GetCount()): a = self.m_listBox1.GetString(i) lista=a.split(',') descripcion=lista[0] des1.descuento=lista[0] rd=des1.consultar(con1) monto=lista[1] monto=monto[0:len(monto)] impripro=lista[2] impripro=impripro[0:len(impripro)] imprinmo=lista[3] imprinmo=imprinmo[0:len(imprinmo)] imprinq=lista[4] imprinq=imprinq[0:len(imprinq)] cont1.agregar(con1,descripcion,monto,impripro,imprinmo,imprinq,rd[1]) self.Destroy() event.Skip() def eliminarcontrato( self, event ): Casa1.contrato='0' Casa1.direccion=self.m_textCtrl32.GetValue() Casa1.desalquilar(con1) cont1.eliminar(con1) self.Destroy() event.Skip()