def acceptDlg(self): try: if (String.IsNullOrEmpty(self.txtName.Value) == False and String.IsNullOrEmpty(self.txtEmail.Value) == False): machinCode = "" obj = SerialKeyConfiguration() # //string code = objGenerate.doKey(30); machinCode = str(obj.MachineCode) messagebody = "" messagebody += "Name: " + self.txtName.Value + "\n" messagebody += "Email: " + self.txtEmail.Value + "\n" messagebody += "Phone Number : " + self.txtPhoneNo.Value + "\n" messagebody += "Company: " + self.txtCompany.Value + "\n" messagebody += "Address: " + self.txtAddress.Value + "\n" messagebody += "Machine code: " + str(machinCode) + "\n" import smtplib from email.mime.text import MIMEText subject = define.MailSubject msg = MIMEText(String.QString2Str(messagebody)) msg['Subject'] = define.MailSubject message = self.createhtmlmail(subject, None, messagebody) server = smtplib.SMTP_SSL(define.smtpServer + ":" + str(define.smtpPort)) server.login(define.email, define.password) server.sendmail(define.FromEmail, define.ToEmail, msg.as_string()) server.quit() # client = new SmtpClient(SMTPSERVER); # client.Port = SMTPPORT; # client.EnableSsl = true; # client.Timeout = 100000; # client.DeliveryMethod = SmtpDeliveryMethod.Network; # client.UseDefaultCredentials = false; # client.Credentials = new NetworkCredential( # SMTPEmail, SMTPPassword); # MailMessage msg = new MailMessage(); # msg.To.Add(ToEmail); # msg.From = new MailAddress(FromEmail); # msg.Subject = MailSubject; # msg.Body = messagebody; # System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate(object s, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors) { return true; }; # client.Send(msg); # MessageBox.Show("Successfully Sent Message."); else: QMessageBox.warning( self, "Warning", "Sorry! Name and email is required field.") except Exception as ex: QMessageBox.warning(self, "Warning", ex.message) self.accept()
def getLicenceKey(self): licanceKey = "" if (String.IsNullOrEmpty(self.txtKeyPart1.text()) == False and String.IsNullOrEmpty(self.txtKeyPart2.text()) == False and String.IsNullOrEmpty(self.txtKeyPart3.text()) == False and String.IsNullOrEmpty(self.txtKeyPart4.text()) == False): if (self.txtKeyPart1.text().length() == 5 and self.txtKeyPart2.text().length() == 5 and self.txtKeyPart3.text().length() == 5 and self.txtKeyPart4.text().length() == 5): licanceKey = self.txtKeyPart1.text( ) + "-" + self.txtKeyPart2.text( ) + "-" + self.txtKeyPart3.text( ) + "-" + self.txtKeyPart4.text() return licanceKey
def smethod_0(string_0, stringBuilder_0): stringBuilder_0.AppendLine( "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">" ) stringBuilder_0.AppendLine("<html>") stringBuilder_0.AppendLine("<head>") stringBuilder_0.AppendLine( String.Concat(["<title>", string_0, "</title>"])) stringBuilder_0.AppendLine("<style type=\"text/css\">") stringBuilder_0.AppendLine( "body { font:12px tahoma,12px helvetica,12px arial,12px verdana; font:size: 100%; }" ) stringBuilder_0.AppendLine( "table { font:12px tahoma,12px helvetica,12px arial,12px verdana; font:size: 100%; border-collapse: collapse; }" ) stringBuilder_0.AppendLine( "th { border: 1px solid black; text-align: center; vertical-align: middle; }" ) stringBuilder_0.AppendLine( "td { border: 1px solid black; text-align: left; vertical-align: middle; }" ) stringBuilder_0.AppendLine( "tr { border: 1px solid black; text-align: left; vertical-align: middle; }" ) stringBuilder_0.AppendLine("</style>") stringBuilder_0.AppendLine("</head>") stringBuilder_0.AppendLine("<body>")
def __init__(self, xmlNode_0=None, string_0=None, string_1=None, string_2=None, string_3=None): ProcEntityBase.__init__(self) if xmlNode_0 != None: xmlNodes = xmlNode_0.namedItem("FtoUid") xmlNodes1 = xmlNodes.namedItem("AhpUid") self.codeId = xmlNodes1.namedItem("codeId").toElement().text() self.txtDesig = xmlNodes.namedItem("txtDesig").toElement().text() self.geoLat = xmlNode_0.namedItem("geoLat").toElement().text() self.geoLong = xmlNode_0.namedItem("geoLong").toElement().text() self.txtName = "{0}".format(self.codeId, self.txtDesig) if (self.codeId != self.txtDesig): procEntityFCP = self self.txtName = String.Concat( [procEntityFCP.txtName, " {0}".format(self.txtDesig)]) else: self.codeId = string_0 self.txtDesig = string_1 self.geoLat = string_2 self.geoLong = string_3 self.txtName = "{0} {1}".format(string_0, string_1)
def translate(self, context, sourceText, disambiguation=None, encoding=QCoreApplication.UnicodeUTF8, n=-1): # da usare in una riga senza accoppiarla ad altre chiamate ad esempio (per lupdate.exe che altrimenti non le trova): # NON VA BENE # proplist["blockScale"] = [QadMsg.translate("Dimension", "Scala frecce"), \ # self.blockScale] # VA BENE # msg = QadMsg.translate("Dimension", "Scala frecce") # proplist["blockScale"] = [msg, self.blockScale] # contesti: # "QAD" per traduzioni generali # "Popup_menu_graph_window" per il menu popup nella finestra grafica # "Text_window" per la finestra testuale # "Command_list" per nomi di comandi # "Command_<nome comando in inglese>" per traduzioni di un comando specifico (es. "Command_PLINE") # "Snap" per i tipi di snap # finestre varie (es. "DSettings_Dialog", DimStyle_Dialog, ...) # "Dimension" per le quotature # "Environment variables" per i nomi delle variabili di ambiente # "Help" per i titoli dei capitoli del manuale che servono da section nel file html di help return String.QString2Str( QCoreApplication.translate(context, sourceText, disambiguation, encoding, n))
def acceptDlg(self): strS = None # self.errorProvider.method_1(); # self.pnlAerodrome.method_0(); # self.pnlDesignator.method_0(); # self.pnlType.method_0(); # self.pnlRNP.method_1(new Validator(ValidationFlags.AllowEmpty | ValidationFlags.Positive)); # if (self.errorProvider.HasErrors) # { # return; # } selectedItem = self.pnlAerodrome.SelectedItem num = (self.pnlAcCategory.SelectedIndex >= 0) and self.pnlAcCategory.SelectedIndex or -1 for row in self.table: flag = True if (self.selected != None and row == self.selected): flag = False if (row["ahpEnt"] != selectedItem): flag = False if (not self.pnlDesignator.Value == row["txtDesig"]): flag = False if (num != (row["codeCatAcft"] == None) and -1 or int(row["codeCatAcft"])): flag = False strS = (row["codeTransId"] == None) and "" or row["codeTransId"] if (not self.pnlTransID.Value == strS): flag = False if (not flag): continue str1 = "Cannot create a duplicate procedure entry.\n\nAerodrome = {0}\nDesignator = {1}".format( self.pnlAerodrome.SelectedItem, self.pnlDesignator.Value) if (self.pnlAcCategory.SelectedIndex >= 0): str1 = String.Concat([ str1, "\nAc. Category = {0}".format( self.pnlAcCategory.SelectedItem) ]) if (not String.IsNullOrEmpty(self.pnlTransID.Value)): str1 = String.Concat([ str1, "\nTransition Identifier = {0}".format( self.pnlTransID.Value) ]) QMessageBox.warning(self, "Error", str1) return self.accept()
def btnActivateNow_Click(self): licenceKey = self.getLicenceKey() if (String.IsNullOrEmpty(licenceKey) == False): objValidate = Validate() objValidate.secretPhase = "aerodrome$pw3s$Pa$$W0rd" #Constants.SKGLSecretPhase; objValidate.Key = String.QString2Str(licenceKey).replace("-", "") # filePath = define.appPath + "/key.key" # fileStream = open(filePath, 'wb') # fileStream.write(licenceKey) # fileStream.close() # self.accept(); if (objValidate.IsValid and objValidate.IsOnRightMachine): import _winreg as wr aReg = wr.ConnectRegistry(None, wr.HKEY_LOCAL_MACHINE) aKey = None try: targ = r'SOFTWARE\Microsoft\Windows\FlightPlannerLicense' print "*** Writing to", targ, "***" try: aKey = wr.OpenKey(aReg, targ, 0, wr.KEY_WRITE) except: aKey = wr.CreateKey(aReg, targ) try: try: wr.SetValueEx(aKey, "License", 0, wr.REG_SZ, String.QString2Str(licenceKey)) except Exception: print "Encountered problems writing into the Registry..." except: print "NO" finally: wr.CloseKey(aKey) except: print "no" finally: try: wr.CloseKey(aReg) self.accept() except: pass else: QtGui.QMessageBox.warning(self, "Warning", "Please enter a valid key.")
def getLLCornerLongitude1kk(self, inomen): """Get lower left Longitude for 1:1.000.000 scale """ inomen = String.QString2Str(inomen) fuso = int(inomen[3:5]) x = 0 if ((fuso > 0) and (fuso <= 60)): x = (((fuso - 30) * 6.0) - 6.0) return x
def smethod_6(string_0): num = 0 string0 = string_0 string0 = String.QString2Str(string0) for si in string0: if (si != ' '): return num num += 1 return num
def smethod_1(dataBaseProcedureData_0, procEntityListType_0, point3d_0, textString, strS): procEntityBases = [] for case in switch(procEntityListType_0): if case(ProcEntityListType.Holding) or case( ProcEntityListType.Fixes) or case( ProcEntityListType.FixesEx) or case( ProcEntityListType.Centers) or case( ProcEntityListType.CentersEx): if (not String.IsNullOrEmpty(textString) and not String.IsNullOrEmpty(strS)): dataBaseProcedureData_0.method_60(procEntityBases, procEntityListType_0, textString, strS) return procEntityBases else: return None return None
def getHemisphereMultiplier(self, inomen): """Check the hemisphere """ inomen = String.QString2Str(inomen) if len(inomen) > 1: h = inomen[0].upper() if h == 'S': return -1 else: return 1
def getLLCornerLatitude1kk(self, inomen): """Get lower left Latitude for 1:1.000.000 scale """ inomen = String.QString2Str(inomen) l = inomen[1].upper() y = 0.0 operator = self.getHemisphereMultiplier(inomen) verticalPosition = string.uppercase.index(l) y = (y + 4 * verticalPosition) * operator if (operator < 0): y -= 4 return y
def ToString(self): if (self == None): return ""; stringBuilder = StringBuilder(); strArrays = self; for i in range(len(strArrays)): strS = strArrays[i]; if (not String.IsNullOrEmpty(strS)): if (stringBuilder.Length > 0): stringBuilder.Append(", "); stringBuilder.Append(strS); return stringBuilder.ToString();
def smethod_1(navigationalAid_0, navigationalAid_1): num = 0 # num = navigationalAid_1.HardCoded.CompareTo(navigationalAid_0.HardCoded) if (navigationalAid_1.HardCoded and navigationalAid_0.HardCoded) or (not navigationalAid_1.HardCoded and not navigationalAid_0.HardCoded): num = 0 elif (not navigationalAid_1.HardCoded and navigationalAid_0.HardCoded): num = -1 elif (navigationalAid_1.HardCoded and not navigationalAid_0.HardCoded): num = 1 if (num == 0): num = String.Str2QString(navigationalAid_0.DisplayName).compare(navigationalAid_1.DisplayName) return num
def get_ReferencePathIdentifier(self): num = 8 chrArray = ['', '', '', ''] i = 3 while i >= 0: if (ord(chr(self.bytes[num])) >= 32): chrArray[i] = chr(ord(chr(self.bytes[num]))) else: chrArray[i] = chr(ord(chr(self.bytes[num])) | 64) num += 1 i -= 1 return String.CharArray2Str(chrArray)
def get_AirportId(self): num = 1 chrArray = ['', '', '', ''] i = 3 while i >= 0: if (ord(chr(self.bytes[num])) >= 32): chrArray[i] = chr(ord(chr(self.bytes[num]))) else: chrArray[i] = chr(ord(chr(self.bytes[num])) | 64) num += 1 i -= 1 return String.CharArray2Str(chrArray)
def HtmlBody(self, lines, title): lines.AppendLine("<div align=\"center\">"); if (not String.IsNullOrEmpty(title)): lines.AppendLine("<p align=\"center\"><b>{0}</b></p>".format(title)); lines.AppendLine("<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\">"); lines.AppendLine("<tbody>"); strArrays = Extensions.smethod_3(self.Text); num = self.method_12(strArrays); for i in range(len(strArrays)): lines.AppendLine("<tr>{0}</tr>".format(self.method_14(strArrays[i], i, num))); lines.AppendLine("</tbody>"); lines.AppendLine("</table>"); lines.AppendLine("</div>");
def method_11(self): clipboard = QApplication.clipboard() clipboard.clear() # if (self.childName == "QASnapshot"): # clipboard.setImage(self.Image); # return; # dataObject = DataObject(); dataObject = "" stringBuilder = StringBuilder() stringBuilder.Append("Version:0.9\r\n") stringBuilder.Append("StartHTML:aaaaaaaaaa\r\n") stringBuilder.Append("EndHTML:bbbbbbbbbb\r\n") stringBuilder.Append("StartFragment:cccccccccc\r\n") stringBuilder.Append("EndFragment:dddddddddd\r\n") length = stringBuilder.Length num = stringBuilder.Length stringBuilder.Append("<!--StartFragment-->\r\n") stringBuilder.Append(self.method_5()) stringBuilder.Append("<!--EndFragment-->\r\n") length1 = stringBuilder.Length num1 = stringBuilder.Length stringBuilder.Replace("aaaaaaaaaa", String.Number2String(length, "0000000000"), 0, length) stringBuilder.Replace("bbbbbbbbbb", String.Number2String(num1, "0000000000"), 0, length) stringBuilder.Replace("cccccccccc", String.Number2String(num, "0000000000"), 0, length) stringBuilder.Replace("dddddddddd", String.Number2String(length1, "0000000000"), 0, length) dataObject += stringBuilder.ToString() + "\n" dataObject += self.ToString() + "\n" # dataObject.SetData(DataFormats.Html, stringBuilder.ToString()); # dataObject.SetData(DataFormats.UnicodeText, this.ToString()); clipboard.setText(dataObject)
def set_Value(self, valueFloat): if self.numberResolution != None: if valueFloat == None or valueFloat == "": rStr = String.Number2String(0, self.numberResolution) self.numberBox.setText(rStr) return try: test = float(valueFloat) rStr = String.Number2String(test, self.numberResolution) self.numberBox.setText(rStr) except: str0 = "You must put the float type in \"%s\"."%(self.Caption) QMessageBox.warning(self, "Warning" , str0) rStr = String.Number2String(0, self.numberResolution) self.numberBox.setText(rStr) else: try: test = int(valueFloat) self.numberBox.setValue(test) except: str0 = "You must put the float type in \"%s\"."%(self.Caption) QMessageBox.warning(self, "Warning" , str0) self.numberBox.setValue(0)
def method_4(self, iwin32Window_0, string_0, qafileVersion_0): try: count = len(self.Sessions) if (count <= 0 or not self.sessions[count - 1].Corrupted or len(self.sessions[count - 1].Children) != 0): tempFileName = define.appPath + "/tempFile.txt" fileT = QFile(string_0) binaryWriter = file(tempFileName, "w") # using (FileStream fileStream = File.Open(tempFileName, FileMode.Create, FileAccess.write, FileShare.Read)) # { # using (BinaryWriter binaryWriter = new BinaryWriter(fileStream)) # { binaryWriter.write("PHXQAA") for case in switch(qafileVersion_0): if case(QAFileVersion.V4) or case(QAFileVersion.V4_1): if (qafileVersion_0 != QAFileVersion.V4): binaryWriter.write(str(4.1)) else: binaryWriter.write(str(4)) self.method_14(binaryWriter, qafileVersion_0) break elif case(QAFileVersion.V8) or case(QAFileVersion.V8_1): if (qafileVersion_0 != QAFileVersion.V8): binaryWriter.write(str(8.1)) else: binaryWriter.write(str(8)) self.method_16(binaryWriter, qafileVersion_0) break elif case(QAFileVersion.V10): binaryWriter.write(10) self.method_16(binaryWriter, qafileVersion_0) break else: QMessageBox.warning( iwin32Window_0, "Error", Messages.ERR_UNSUPPORTED_QA_FILE_VERSION) raise SystemError if (fileT.exists()): string_0 = String.Str2QString(string_0) str0 = string_0.left(string_0.length() - 3) + "qab" if (QFile.exists(str0)): QFile.remove(str0) QFile.copy(string_0, str0) QFile.copy(tempFileName, string_0) except: QMessageBox.warning( iwin32Window_0, "Error", Messages.ERR_FAILED_TO_SAVE_ACTIVE_QA_FILE.format( sys.exc_info()[0]))
def smethod_0(string_0): stringBuilder = StringBuilder(string_0) num = 0 tempChrList = String.ToCharArray(string_0) while (num < stringBuilder.Length): if (tempChrList[num] == '\r'): if (num >= stringBuilder.Length - 1 or stringBuilder[num + 1] != '\n'): num += 1 stringBuilder.Insert(num, '\n') else: num = num + 2 continue num += 1 return stringBuilder.ToString()
def set_HexString(self, value): if value == "": return # value = value.replace(" ", "") if (self.bytes == None or len(self.bytes) != 40): self.bytes = bytearray(40) i = 0 valueList = value.split(' ') while i< 40: if isinstance(value, QString): # ss = value.mid(i, 2) self.bytes[i] = Type.ByteFunc.d2b(int(String.QString2Str(valueList[i]), 16)) else: self.bytes[i] = Type.ByteFunc.d2b(int(valueList[i], 16)) i += 1
def smethod_4(string_0): symbol = None; flag = False; if isinstance(string_0, QString): string_0 = String.QString2Str(string_0) if ((string_0[len(string_0) - 1:] == 'm' or string_0[len(string_0) - 1:] == 'M') and not string_0 == "phxlmm"): string_0 = string_0[:len(string_0) - 1]; flag = True; for current in SymbolTypeList: if current != string_0: # if (!string_0.StartsWith(string.Concat("PHX", current.ToString().ToLower()), StringComparison.InvariantCultureIgnoreCase)) # { continue; symbol = Symbol(current, flag); return symbol; return None;
def getLLCorner(self, inomen): """Get lower left coordinates for scale determined by the given map index """ inomen = String.QString2Str(inomen) x = self.getLLCornerLongitude1kk(inomen) y = self.getLLCornerLatitude1kk(inomen) inomenParts = inomen.upper().split('-') #Escala de 500.00 for partId in range(2, len(inomenParts)): scaleId = partId - 1 dx = self.getSpacingX(self.scales[scaleId]) dy = self.getSpacingY(self.scales[scaleId]) scaleText = inomenParts[partId] i, j = self.findScaleText(scaleText, partId - 1) x += i * dx y += j * dy return (x, y)
def method_6(self, bool_0, string_0, string_1): position = None stringBuilder = StringBuilder() str0 = "qa:{0}".format(string_1.Length) if (self.method_5(PositionType.START)): position = self.method_1(PositionType.START).method_3() if ( not bool_0) else self.method_1(PositionType.START).method_2() stringBuilder.AppendLine( String.Concat( [string_0, PositionType.Items[position.Type - 1]])) stringBuilder.AppendLine(position.method_5(str0)) if (self.method_5(PositionType.THR)): position = self.method_1(PositionType.THR).method_3() if ( not bool_0) else self.method_1(PositionType.THR).method_2() stringBuilder.AppendLine( String.Concat( [string_0, PositionType.Items[position.Type - 1]])) stringBuilder.AppendLine(position.method_5(str0)) for position1 in self: if (position1.Type != PositionType.Position or not position1.IsValidIncludingAltitude): continue position = position1.method_3() if ( not bool_0) else position1.method_2() stringBuilder.AppendLine( String.Concat( [string_0, PositionType.Items[position.Type - 1]])) stringBuilder.AppendLine(position.method_5(str0)) if (self.method_5(PositionType.END)): position = self.method_1(PositionType.END).method_3() if ( not bool_0) else self.method_1(PositionType.END).method_2() stringBuilder.AppendLine( String.Concat( [string_0, PositionType.Items[position.Type - 1]])) stringBuilder.AppendLine(position.method_5(str0)) if (self.method_5(PositionType.SWY)): position = self.method_1(PositionType.SWY).method_3() if ( not bool_0) else self.method_1(PositionType.SWY).method_2() stringBuilder.AppendLine( String.Concat( [string_0, PositionType.Items[position.Type - 1]])) stringBuilder.AppendLine(position.method_5(str0)) if (self.method_5(PositionType.CWY)): position = self.method_1(PositionType.CWY).method_3() if ( not bool_0) else self.method_1(PositionType.CWY).method_2() stringBuilder.AppendLine( String.Concat( [string_0, PositionType.Items[position.Type - 1]])) stringBuilder.AppendLine(position.method_5(str0)) return stringBuilder.ToString()
def WriteSettings(self): import _winreg as wr aReg = wr.ConnectRegistry(None, wr.HKEY_LOCAL_MACHINE) targ = r'SOFTWARE\Microsoft\Windows\FlightPlannerLicense' print "*** Writing to", targ, "***" try: aKey = wr.OpenKey(aReg, targ, 0, wr.KEY_WRITE) except: aKey = wr.CreateKey(aReg, targ) try: try: wr.SetValueEx(aKey, "ProjectPath", 0, wr.REG_SZ, String.QString2Str(self.ProjectFolderPath)) except Exception: print "Encountered problems writing into the Registry..." except: print "NO" finally: wr.CloseKey(aKey) wr.CloseKey(aReg)
def String2Degree(qStr): qStr = String.Str2QString(qStr) degreeFormat = qStr.right(1) existFormat = False tempDegreeStr = None if degreeFormat == "E" or degreeFormat == "W" or\ degreeFormat == "e" or degreeFormat == "w" or\ degreeFormat == "N" or degreeFormat == "S" or\ degreeFormat == "n" or degreeFormat == "s": existFormat = True if existFormat: tempDegreeStr = qStr.left(qStr.length() - 1) else: tempDegreeStr = qStr tempDegreeFloat = None try: tempDegreeFloat = float(tempDegreeStr) except: return None ssDecimal = tempDegreeFloat - int(tempDegreeFloat) degreeQStrWithOutDecimal = QString(str(int(tempDegreeFloat))) ssInt = int(degreeQStrWithOutDecimal.right(2)) degreeQStrWithOutDecimal = degreeQStrWithOutDecimal.left( degreeQStrWithOutDecimal.length() - 2) mmInt = int(degreeQStrWithOutDecimal.right(2)) degreeQStrWithOutDecimal = degreeQStrWithOutDecimal.left( degreeQStrWithOutDecimal.length() - 2) ddInt = int(degreeQStrWithOutDecimal) decimaldegree = ddInt + float(mmInt) / 60 + float(ssInt + ssDecimal) / 3600 if degreeFormat == "E" or degreeFormat == "W" or\ degreeFormat == "e" or degreeFormat == "w": return Degrees(decimaldegree, None, None, DegreesType.Longitude) elif degreeFormat == "N" or degreeFormat == "S" or\ degreeFormat == "n" or degreeFormat == "s": return Degrees(decimaldegree, None, None, DegreesType.Latitude) return Degrees(decimaldegree)
def smethod_11(string_0, string_1, string_2): if (String.IsNullOrEmpty(string_1)): return string_0 stringBuilder = StringBuilder() if not isinstance(string_0, QString): string_0 = QString(string_0) if not isinstance(string_1, QString): string_1 = QString(string_1) if not isinstance(string_2, QString): string_2 = QString(string_2) length = string_1.length() num = -1 num1 = 0 while (True): num = string_0.indexOf(string_1, num + 1) if (num < 0): break stringBuilder.Append(string_0, num1, num - num1) stringBuilder.Append(string_2) num1 = num + length stringBuilder.Append(string_0, num1, string_0.length() - num1) return QString(stringBuilder.ToString())
def set_Value(self, value): if isinstance(value, AngleGradientSlope): self.txtDegree.setText(str(round(value.Degrees, 4))) return # if self.captionUnits == AngleGradientSlopeUnits.Degrees: # rStr = String.Number2String(value.Degrees, self.numberResolution) # self.angleGradientBox.setText(rStr) # elif self.captionUnits == AngleGradientSlopeUnits.Percent: # rStr = String.Number2String(value.Percent, self.numberResolution) # self.angleGradientBox.setText(rStr) # elif self.captionUnits == AngleGradientSlopeUnits.Slope: # rStr = String.Number2String(value.Slope, self.numberResolution) # self.angleGradientBox.setText(rStr) # return try: test = float(value) rStr = String.Number2String(test, self.numberResolution) self.txtDegree.setText(rStr) except: str0 = "You must put the float type in \"%s\"." % (self.Caption) QMessageBox.warning(self, "Warning", str0) # rStr = String.Number2String(0, self.numberResolution) self.txtDegree.setText("0.0")
def smethod_0(dataBaseIAPs_0, dataBaseProcedureData_0, dataRow_0): flag = False dlgAixmIap = DlgAixmIap() dlgAixmIap.data = dataBaseProcedureData_0 dlgAixmIap.table = dataBaseIAPs_0 dlgAixmIap.selected = dataRow_0 dataBaseProcedureData_0.method_51(dlgAixmIap.pnlAerodrome) dataBaseProcedureData_0.method_47(dlgAixmIap.pnlMSA) dlgAixmIap.pnlAcCategory.Items = CodeCatAcftAixm.Items dlgAixmIap.pnlType.Items = CodeTypeIapAixm.Items # dlgAixmIap.pnlAcCategory.Insert(0, ""); # dlgAixmIap.pnlMSA.Items.Insert(0, ""); if (dataRow_0 != None and len(dataRow_0) != 0): dlgAixmIap.pnlAerodrome.SelectedIndex = dlgAixmIap.pnlAerodrome.IndexOf( dataRow_0["ahpEnt"]) if (dlgAixmIap.pnlAerodrome.SelectedIndex >= 0): dataBaseProcedureData_0.method_35( dlgAixmIap.pnlRunway, dlgAixmIap.pnlAerodrome.SelectedItem) # dlgAixmIap.pnlRunway.Insert(0, ""); dlgAixmIap.pnlDesignator.Value = dataRow_0["txtDesig"] if (dataRow_0["codeCatAcft"] != None): dlgAixmIap.pnlAcCategory.SelectedIndex = dlgAixmIap.pnlAcCategory.method_3( dataRow_0["codeCatAcft"]) if (dataRow_0["codeTransId"] != None): dlgAixmIap.pnlTransID.Value = dataRow_0["codeTransId"] if (dataRow_0["rdnEnt"] != None): dlgAixmIap.pnlRunway.SelectedIndex = dlgAixmIap.pnlRunway.IndexOf( dataRow_0["rdnEnt"]) if (dataRow_0["mgpEnt"] != None): dlgAixmIap.pnlMSA.SelectedIndex = dlgAixmIap.pnlMSA.IndexOf( dataRow_0["mgpEnt"]) if (dataRow_0["codeRnp"] != None): dlgAixmIap.pnlRNP.Value = dataRow_0["codeRnp"] if (dataRow_0["txtDescrComFail"] != None): dlgAixmIap.txtDescrComFail.Value = dataRow_0["txtDescrComFail"] dlgAixmIap.pnlType.SelectedIndex = dlgAixmIap.pnlType.method_3( dataRow_0["codeTypeRte"]) if (dataRow_0["txtDescrMiss"] != None): dlgAixmIap.txtDescription.Value = dataRow_0["txtDescrMiss"] if (dataRow_0["txtRmk"] != None): dlgAixmIap.txtRemarks.Value = dataRow_0["txtRmk"] dlgAixmIap.minimums = dataRow_0["ocah"] if (dlgAixmIap.minimums == None): dlgAixmIap.minimums = DataBaseIapOcaOchs() dlgAixmIap.gridOcahModel.DataSource = dlgAixmIap.minimums resultDlg = dlgAixmIap.exec_() if resultDlg == 1: dataRow0 = dataRow_0 == None or len(dataRow_0) == 0 strS = [] if (not dataRow0): for i in range(len(dataBaseIAPs_0.nameList)): strS.append(None) # strS = new string[dataBaseIAPs_0.Columns.Count]; i = 0 for name in dataBaseIAPs_0.nameList: strS[i] = dataRow_0[name] i += 1 else: dataRow_0 = dataBaseIAPs_0.NewRow() dataRow_0["ahpEnt"] = dlgAixmIap.pnlAerodrome.SelectedItem if (dataRow0): dataRow_0["oldAhpEnt"] = dataRow_0["ahpEnt"] dataRow_0["txtDesig"] = dlgAixmIap.pnlDesignator.Value if (dataRow0): dataRow_0["oldTxtDesig"] = dataRow_0["txtDesig"] if (dlgAixmIap.pnlAcCategory.SelectedIndex >= 0): dataRow_0[ "codeCatAcft"] = dlgAixmIap.pnlAcCategory.SelectedItem else: dataRow_0["codeCatAcft"] = None if (dataRow0): dataRow_0["oldCodeCatAcft"] = dataRow_0["codeCatAcft"] if (not String.IsNullOrEmpty(dlgAixmIap.pnlTransID.Value)): dataRow_0["codeTransId"] = dlgAixmIap.pnlTransID.Value else: dataRow_0["codeTransId"] = None if (dataRow0): dataRow_0["oldCodeTransId"] = dataRow_0["codeTransId"] if (dlgAixmIap.pnlRunway.SelectedIndex >= 0): dataRow_0["rdnEnt"] = dlgAixmIap.pnlRunway.SelectedItem else: dataRow_0["rdnEnt"] = None if (dlgAixmIap.pnlMSA.SelectedIndex >= 0): dataRow_0["mgpEnt"] = dlgAixmIap.pnlMSA.SelectedItem else: dataRow_0["mgpEnt"] = None if (not math.isnan(dlgAixmIap.pnlRNP.Value) and not math.isinf(dlgAixmIap.pnlRNP.Value)): dataRow_0["codeRnp"] = dlgAixmIap.pnlRNP.Value else: dataRow_0["codeRnp"] = None dataRow_0["codeTypeRte"] = dlgAixmIap.pnlType.SelectedItem if (not String.IsNullOrEmpty(dlgAixmIap.txtDescrComFail.Value)): dataRow_0["txtDescrComFail"] = dlgAixmIap.txtDescrComFail.Value else: dataRow_0["txtDescrComFail"] = None if (not String.IsNullOrEmpty(dlgAixmIap.txtDescription.Value)): dataRow_0["txtDescrMiss"] = dlgAixmIap.txtDescription.Value else: dataRow_0["txtDescrMiss"] = None if (not String.IsNullOrEmpty(dlgAixmIap.txtRemarks.Value)): dataRow_0["txtRmk"] = dlgAixmIap.txtRemarks.Value else: dataRow_0["txtRmk"] = None dataRow_0["ocah"] = dlgAixmIap.minimums if (dataRow0): dataRow_0["procLegs"] = DataBaseProcedureLegs() dataRow_0["procLegsEx"] = DataBaseProcedureLegsEx() if (not dataRow0): num = 1 while (num < len(strS)): if (not strS[num] == dataRow_0[dataRow_0.nameList[num]]): dataRow_0["changed"] = "True" if (dataRow0): dataBaseIAPs_0.RowsAdd(dataRow_0) flag = True return flag else: num += 1 else: dataRow_0["new"] = "True" if (dataRow0): dataBaseIAPs_0.RowsAdd(dataRow_0) flag = True return flag return flag