def method_6(self, string_0, treeNodeCollection_0): value = None # using (TextWriter streamWriter = new StreamWriter(string_0, false, Encoding.Unicode)) streamWriter = open(string_0, 'w') stringBuilder = StringBuilder() QARecord.smethod_0(self.fileNameQA, stringBuilder) streamWriter.write(stringBuilder.ToString()) fileInfo = QFileInfo(string_0) directoryName = fileInfo.path() num = 1 for treeNodeCollection0 in treeNodeCollection_0: tag = treeNodeCollection0.Tag# as QAReportEntry stringBuilder = StringBuilder() stringBuilder.AppendLine("<p align=\"left\"><H2><br>{0}. {1}<br></H2></p>".format(str(treeNodeCollection0.Index + 1), treeNodeCollection0.Text)) if (tag.Value != None): value = tag.Value if (value.Type != QARecordType.Snapshot): value.method_6(stringBuilder, None, False, False) else: value._class_ = QASnapshot num = value.method_12(stringBuilder, value, directoryName, num) else: for node in treeNodeCollection0.Nodes: tag = node.Tag# as QAReportEntry stringBuilder.AppendLine("<p align=\"left\"><H3><br>{0}.{1} {2}<br></H3></p>".format(str(treeNodeCollection0.Index + 1), str(node.Index + 1), node.Text)) value = tag.Value if (value.Type != QARecordType.Snapshot): value.method_6(stringBuilder, None, False, False) else: value._class_ = QASnapshot num = value.method_12(stringBuilder, value, directoryName, num) streamWriter.write(stringBuilder.ToString()) stringBuilder = StringBuilder() QARecord.smethod_1(stringBuilder) streamWriter.write(stringBuilder.ToString())
def method_5(self, string_0, qaexportType_0): resultStr = "" stringBuilder = StringBuilder() fileInfo = QFileInfo(string_0) QARecord.smethod_0(self.fileNameQA, stringBuilder) streamWriter = open(string_0, 'w') resultStr += stringBuilder.ToString() + "\n" # streamWriter.write(stringBuilder.ToString()) directoryName = fileInfo.path() num = 1 num1 = 1 for i in range(len(self.sessions)): item = self.sessions[i] if (qaexportType_0 == QAExportType.QA): stringBuilder = StringBuilder() str0 = Extensions.smethod_19(item.Stamp) if (item.SessionType != QASessionType.Started): stringBuilder.AppendLine( "<p align=\"left\"><H2><br>{0} {1} ({2})<br></H2></p>". format(str(i + 1), Captions.QA_OPENED, str0)) else: stringBuilder.AppendLine( "<p align=\"left\"><H2><br>{0} {1} ({2})<br></H2></p>". format(str(i + 1), Captions.QA_STARTED, str0)) item.method_6(stringBuilder, None, False, False) resultStr += stringBuilder.ToString() + "\n" # streamWriter.write(stringBuilder.ToString()) for j in range(len(item.Children)): qARecord = item.Children[j] if (qARecord.Type != QARecordType.Session): stringBuilder = StringBuilder() if (qaexportType_0 != QAExportType.QA): stringBuilder.AppendLine( "<p align=\"left\"><H2><br>{0}. {1}<br></H2></p>". format(str(num1), qARecord.Heading)) else: longTimeString = qARecord.Stamp.ToLongTimeString() heading = [ i + 1, j + 1, qARecord.Heading, longTimeString ] stringBuilder.AppendLine( "<p align=\"left\"><H3><br>{0}.{1} {2} ({3})<br></H3></p>" .format(str(i + 1), str(j + 1), qARecord.Heading, longTimeString)) if (qARecord.Type != QARecordType.Snapshot): qARecord.method_6(stringBuilder, None, False, False) else: qARecord._class_ = QASnapshot num = qARecord.method_12(stringBuilder, qARecord, directoryName, num) resultStr += stringBuilder.ToString() + "\n" # streamWriter.write(stringBuilder.ToString()) num1 += 1 stringBuilder = StringBuilder() QARecord.smethod_1(stringBuilder) resultStr += stringBuilder.ToString() + "\n" streamWriter.write(resultStr)
def ToString(self, format_0 = None): stringBuilder = StringBuilder() if format_0 == None: format_0 = "" if not isinstance(format_0, QString): format_0 = String.Str2QString(format_0) # if (provider == null) # { # provider = CultureInfo.CurrentCulture # } if (not String.IsNullOrEmpty(format_0)): format_0 = format_0.toUpper() if (format_0.contains("QA:")): format_0 = format_0.replace("QA:", "") num = 0 try: num = int(format_0) except: num = 0 stringBuilder = StringBuilder() str0 = "" for i in range(num): str0 = QString(String.Concat([str0, " "])) if (not String.IsNullOrEmpty(self.id)): stringBuilder.AppendLine("{0}{1}\t{2}".format(str0, Captions.ID, self.id)) if (not self.xy): lATITUDE = Captions.LATITUDE degree = Degrees.smethod_1(self.xlat) stringBuilder.AppendLine("{0}{1}\t{2}".format(str0, lATITUDE, degree.method_2())) lONGITUDE = Captions.LONGITUDE degree1 = Degrees.smethod_5(self.ylon) stringBuilder.Append("{0}{1}\t{2}".format(str0, lONGITUDE, degree1.method_2())) else: stringBuilder.AppendLine("{0}{1}\t{2}".format(str0, Captions.X, str(self.xlat)))#.ToString(Formats.GridXYFormat, provider))) stringBuilder.Append("{0}{1}\t{2}".format(str0, Captions.Y, str(self.ylon)))#.ToString(Formats.GridXYFormat, provider))) if (not self.altitude == None): altitude = Altitude(self.altitude) stringBuilder.AppendLine("") aLTITUDE = [str0, Captions.ALTITUDE, altitude.ToString(":m"), altitude.ToString(":ft")] stringBuilder.Append("{0}{1}\t{2} ({3})".format(str0, Captions.ALTITUDE, altitude.ToString(":m"), altitude.ToString(":ft"))) return stringBuilder.ToString() stringBuilder = StringBuilder() if (not String.IsNullOrEmpty(self.id)): stringBuilder.Append(self.id + ", ") if (not self.xy): degree2 = Degrees.smethod_1(self.xlat) str1 = degree2.method_2() degree3 = Degrees.smethod_5(self.ylon) stringBuilder.Append(str1 + ", " + degree3.method_2()) else: stringBuilder.Append(str(self.xlat) + ", " + str(self.ylon)) if (not self.altitude == None): altitude1 = Altitude(self.altitude) stringBuilder.Append(", {0} ({1})", ", " + altitude1.ToString(":m") + " (" + altitude1.ToString(":ft") + ")") return stringBuilder.ToString()
def btnUpdateQA_Click(self): # clip = QApplication.clipboard() # QMessageBox.warning(self, "WWW", clip.text()) # dlg = QaWindow(self) # dlg.show() if (not self.method_27(False)): return text = self.windowTitle() flag, text = DlgQaHeading.smethod_0(self, text) if (flag): qATable = QATable() qATable.TableType = QATableType.General, qATable.Heading = text stringBuilder = StringBuilder() stringBuilder.AppendLine("Runway THR") stringBuilder.AppendLine( self.parametersPanel.pnlTHR.method_8(" ")) stringBuilder.AppendLine("Navigational AID Position") stringBuilder.AppendLine( self.parametersPanel.pnlNavAid.method_8(" ")) stringBuilder.AppendLine( self.parametersPanel.grbParameters.title()) stringBuilder.AppendLine( self.parametersPanel.txtDirection.method_6(" ")) stringBuilder.AppendLine( ComboBox.method_11(self.parametersPanel.cmbCategory, self.parametersPanel.label_69, " ")) qATable.Text = stringBuilder.ToString() FlightPlanBaseSimpleDlg.method_27(self, qATable)
def method_5(self, bool_0, string_0, string_1): position = Position() stringBuilder = StringBuilder() string_1 = QString(string_1) str0 = "qa:{0}".format(string_1.length()) sAFETYAREAWIDTH = Captions.SAFETY_AREA_WIDTH distance = Distance(self.safetyAreaWidth) stringBuilder.AppendLine("{0}{1}\t{2}".format(string_0, sAFETYAREAWIDTH, distance.method_0("0.##:m"))) sAFETYAREALENGTHSTART = Captions.SAFETY_AREA_LENGTH_START distance1 = Distance(self.safetyAreaStart) stringBuilder.AppendLine("{0}{1}\t{2}".format(string_0, sAFETYAREALENGTHSTART, distance1.method_0("0.##:m"))) sAFETYAREALENGTHEND = Captions.SAFETY_AREA_LENGTH_END distance2 = Distance(self.safetyAreaEnd) stringBuilder.AppendLine("{0}{1}\t{2}".format(string_0, sAFETYAREALENGTHEND, distance2.method_0("0.##:m"))) if (self.method_4(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, position.Type.VariableNames[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, position.Type.VariableNames[position.Type - 1]])) stringBuilder.AppendLine(position.method_5(str0)) if (self.method_4(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, position.Type.VariableNames[position.Type - 1]])) stringBuilder.AppendLine(position.method_5(str0)) if (self.method_4(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, position.Type.VariableNames[position.Type - 1]])) stringBuilder.AppendLine(position.method_5(str0)) return stringBuilder.ToString()
def vmethod_2(self, string_0): stringBuilder = StringBuilder() stringBuilder.AppendLine("{0}{1}\t{2}".format(string_0, Captions.NAME, self.name)) if (self.m_a.IsValid()): stringBuilder.AppendLine("{0}{1}\t{2}".format( string_0, "a", self.m_a.method_0(":u"))) if (self.m_b.IsValid()): stringBuilder.AppendLine("{0}{1}\t{2}".format( string_0, "b", self.m_b.method_0(":u"))) if (self.m_h.IsValid()): stringBuilder.AppendLine("{0}{1}\t{2}".format( string_0, "h", self.m_h.method_0(":u"))) if (self.m_r.IsValid()): stringBuilder.AppendLine("{0}{1}\t{2}".format( string_0, "r", self.m_r.method_0(":u"))) if (self.m_D.IsValid()): stringBuilder.AppendLine("{0}{1}\t{2}".format( string_0, "D", self.m_D.method_0(":u"))) if (self.m_H.IsValid()): stringBuilder.AppendLine("{0}{1}\t{2}".format( string_0, "H", self.m_H.method_0(":u"))) if (self.m_L.IsValid()): stringBuilder.AppendLine("{0}{1}\t{2}".format( string_0, "L", self.m_L.method_0(":u"))) if (self.m_phi.IsValid()): stringBuilder.AppendLine("{0}{1}\t{2}".format( string_0, "ɸ", self.m_phi.method_0(":u"))) stringBuilder.AppendLine("{0}{1}\t{2}".format( string_0, Captions.STANDARD, Extensions.smethod_26(self.hardCoded))) return stringBuilder.ToString()
def vmethod_2(self, string_0): stringBuilder = StringBuilder() stringBuilder.AppendLine("{0}{1}\t{2}".format(string_0, Captions.NAME, self.name)) if (self.slope.IsValid()): stringBuilder.AppendLine("{0}{1}\t{2}".format(string_0, Captions.SLOPE, self.slope.method_0(":u"))) if (self.startingHeight.IsValid()): stringBuilder.AppendLine("{0}{1}\t{2}".format(string_0, Captions.STARTING_HEIGHT, self.startingHeight.method_0(":u"))) if (self.finishingDistance.IsValid()): stringBuilder.AppendLine("{0}{1}\t{2}".format(string_0, Captions.FINISHING_DISTANCE, self.finishingDistance.method_0(":u"))) return stringBuilder.ToString()
def get_HexString(self): stringBuilder = StringBuilder() for i in range(40): str0 = hex(ord(chr(self.bytes[i]))).replace("0x", "").upper() if len(str0) == 1: str0 = "0" + str0 stringBuilder.Append(str0) if (i < 39): stringBuilder.Append(" ") return stringBuilder.ToString()
def vmethod_2(self, string_0): stringBuilder = StringBuilder() stringBuilder.AppendLine("{0}{1}\t{2}".format(string_0, Captions.NAME, self.name)) if (self.m_alfa.IsValid()): stringBuilder.AppendLine("{0}{1}\t{2}".format(string_0, "Alpha (α - Cone)", self.m_alfa.method_0(":u"))) if (self.m_R.IsValid()): stringBuilder.AppendLine("{0}{1}\t{2}".format(string_0, "Radius (R - Cone)", self.m_R.method_0(":u"))) if (self.m_r.IsValid()): stringBuilder.AppendLine("{0}{1}\t{2}".format(string_0, "Radius (r - Cylinder)", self.m_r.method_0(":u"))) stringBuilder.AppendLine("{0}{1}\t{2}".format(string_0, Captions.STANDARD, Extensions.smethod_26(self.hardCoded))) return stringBuilder.ToString()
def smethod_7(bool_0): stringBuilder = StringBuilder() i = 0 while i < len(bool_0): stringBuilder.Append(CRC.smethod_8(i, bool_0)) i = i + 4 # for (int i = 0; i < (int)bool_0.Length; i = i + 4) # { # stringBuilder.Append(CRC.smethod_8(i, bool_0)); # } return stringBuilder.ToString().upper()
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 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 getText(self): stringBuilder = StringBuilder() if (self.sessionType == QASessionType.Started): stringBuilder.AppendLine("{0}\t{1}".format(Captions.PROJECT, self.tagProject)) stringBuilder.AppendLine("{0}\t{1}".format(Captions.NAME, self.tagName)) stringBuilder.AppendLine("{0}\t{1}".format(Captions.SECTION, self.tagSection)) stringBuilder.AppendLine("{0}\t{1}".format(Captions.REASON, self.tagReason)) stringBuilder.AppendLine("{0}\t{1}".format(Captions.DWG_NAME, self.dwgFileName)) if (not self.dwgCreated.toString() == self.NULLDATE.toString()): stringBuilder.AppendLine("{0}\t{1}".format( Captions.DWG_CREATED, Extensions.smethod_19(self.dwgCreated))) if (not self.dwgSaved.toString() == self.NULLDATE.toString()): stringBuilder.AppendLine("{0}\t{1}".format( Captions.DWG_LAST_SAVED, Extensions.smethod_19(self.dwgSaved))) if (self.dwgSizeOpened > 0): if (self.dwgSizeOpened >= 1024): stringBuilder.AppendLine("{0}\t{1}".format( Captions.DWG_SIZE_SESSION_OPENED, "{0:0.###} {1}".format(self.dwgSizeOpened / float(1024), Captions.MB))) else: stringBuilder.AppendLine("{0}\t{1}".format( Captions.DWG_SIZE_SESSION_OPENED, "{0:0.###} {1}".format(self.dwgSizeOpened, Captions.KB))) if (self.dwgSizeClosed > 0): if (self.dwgSizeClosed >= 1024): stringBuilder.AppendLine("{0}\t{1}".format( Captions.DWG_SIZE_SESSION_SAVED, "{0:0.###} {1}".format(self.dwgSizeClosed / float(1024), Captions.MB))) else: stringBuilder.AppendLine("{0}\t{1}".format( Captions.DWG_SIZE_SESSION_SAVED, "{0:0.###} {1}".format(self.dwgSizeClosed, Captions.KB))) if (not self.qaLastSaved.toString() == self.NULLDATE.toString()): stringBuilder.AppendLine("{0}\t{1}".format( Captions.QA_LAST_SAVED, Extensions.smethod_19(self.qaLastSaved))) if (not self.correlation): stringBuilder.AppendLine("{0}\t{1}".format( Captions.WARNING, Captions.NO_CORRELATION)) if (self.corrupted): stringBuilder.AppendLine("{0}\t{1}".format( Captions.WARNING, Captions.POSSIBLE_QA_FILE_CORRUPTION)) return stringBuilder.ToString()
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 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 CRC_Calculation(byteArray): numArray = [0, 2577006594, 2553349383, 27985157, 2607222541, 50138895, 55970314, 2597063176, 2647333657, 72424219, 100277790, 2623544860, 111940628, 2671121430, 2661093651, 117903633, 2425566001, 151597875, 144848438, 2436380212, 200555580, 2456697918, 2479175995, 174012729, 223881256, 2495752234, 2506698031, 217263405, 2520721189, 262481703, 235807266, 2543067680, 2317575009, 330916707, 303195750, 2340972132, 289696876, 2296278126, 2306173291, 284125545, 401111160, 2389866618, 2413395327, 373521789, 2358212469, 353728375, 348025458, 2367976048, 447762512, 2200588370, 2189514071, 454776149, 2178375517, 407723871, 434526810, 2155633240, 2273004361, 518081355, 524963406, 2261798476, 471614532, 2240169030, 2217558339, 498549057, 3208889281, 651805635, 661833414, 3202926276, 606391500, 3183398094, 3155544523, 630180297, 579393752, 3138574554, 3132743135, 589553117, 3119503317, 544593879, 568251090, 3091518160, 802222320, 3058364658, 3085039095, 779875829, 3031957501, 757989375, 747043578, 3038575352, 2988174313, 729934827, 707456750, 3014717164, 696050916, 2967921894, 2974671331, 685236705, 895525024, 2902106274, 2907809191, 885761445, 2919739309, 933081007, 909552298, 2947328680, 2829827001, 825342907, 815447742, 2835398332, 869053620, 2857809078, 2885530035, 845656497, 2784203665, 1013552019, 1036162710, 2757269140, 1049926812, 2802752670, 2795870619, 1061132697, 943229064, 2711783562, 2684980623, 965971341, 2740946821, 986023815, 997098114, 2733933184, 3582100097, 1276674691, 1303611270, 3559491460, 1323666828, 3615460750, 3604252811, 1330546825, 1212783000, 3520305562, 3497565343, 1239587997, 3543045781, 1253349015, 1260360594, 3531969424, 1158787504, 3700142514, 3709908151, 1153086645, 3732324029, 1206697663, 1179106234, 3755850680, 3638209193, 1094757035, 1089187758, 3648106412, 1136502180, 3660031398, 3683426467, 1108779169, 1604444640, 3325813218, 3348161767, 1577772261, 3301371629, 1566371567, 1559751658, 3312315368, 3261790969, 1542519547, 1515978750, 3284271100, 1494087156, 3231184374, 3241996531, 1487335665, 3476214481, 1453904595, 1459869654, 3466188756, 1414913500, 3452952030, 3429161179, 1442765017, 1392101832, 3412314570, 3402157263, 1397935309, 3382625989, 1342490311, 1370473410, 3358966720, 1791050048, 4082843970, 4075832391, 1802126405, 4054208077, 1748782671, 1771522890, 4027403080, 4144650841, 1854954075, 1866162014, 4137770844, 1819104596, 4126627158, 4099690579, 1841713233, 4199707249, 1674080883, 1650685814, 4227430260, 1630895484, 4172250494, 4177819771, 1620998265, 1738107240, 4261636458, 4289227887, 1714580589, 4244530789, 1701078631, 1691312994, 4250231648, 3772916257, 2037916195, 2027104038, 3779667748, 2072325420, 3793693998, 3820234795, 2049845289, 2099853624, 3836950842, 3843570751, 2088909885, 3863885365, 2144613943, 2122265394, 3890557744, 1886458128, 3924496658, 3896513559, 1910117397, 3944095261, 1921785375, 1931942682, 3938261784, 3988392457, 1948256779, 1972047630, 3960540940, 1994196228, 4014408966, 4008443907, 2004221953] num = 0 j = 0 progressMessageBar = define._messagBar.createMessage("Reading the file ...") progress = QProgressBar() progress.setAlignment(Qt.AlignLeft|Qt.AlignVCenter) progressMessageBar.layout().addWidget(progress) define._messagBar.pushWidget(progressMessageBar, define._messagBar.INFO) maxium = len(byteArray) progress.setMaximum(maxium) progress.setValue(0) for i in range(len(byteArray)): byte0 = None if isinstance(byteArray, bytearray): byte0 = Type.ByteFunc.d2b(num ^ ord(chr(byteArray[i]))) else: byte0 = Type.ByteFunc.d2b(num ^ ord(byteArray[i])) num = num >> 8 num = num ^ numArray[ord(byte0) % 36] progress.setValue(i) QApplication.processEvents() progress.setValue(maxium) define._messagBar.hide() resultByteArray = bytearray(4) for i in range(4): resultByteArray[i] = '0' resultByteArray[0] = Type.ByteFunc.d2b(num) resultByteArray[1] = Type.ByteFunc.d2b(num >> 8) resultByteArray[2] = Type.ByteFunc.d2b(num >> 16) resultByteArray[3] = Type.ByteFunc.d2b(num >> 24) stringBuilder = StringBuilder() for i in range(4): stringBuilder.Append(hex(ord(chr(resultByteArray[i]))).replace("0x", "").upper()) return stringBuilder.ToString()
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 get_CRC(self): stringBuilder = StringBuilder() for i in range(36, 40): stringBuilder.Append( hex(ord(chr(self.bytes[i]))).replace("0x", "").upper()) return stringBuilder.ToString()
def ToString(self, formatStr=None): if formatStr == None: return self.ToString("G") num = 0.0 num1 = 0.0 num2 = 0.0 if (self.IsNaN): return "" if (formatStr == None or formatStr == ""): formatStr = self.defaultformatStr # if (provider == null) # { # provider = CultureInfo.CurrentCulture; # } # s = QString(45) # s.toUpper() if isinstance(formatStr, QString): formatStr = formatStr.toUpper() else: formatStr = formatStr.upper() if (formatStr == "G"): formatStr = self.defaultformatStr.upper() stringBuilder = StringBuilder() strS = None str1 = None str2 = None num3 = 0 num4 = 0 num5 = 0 length = -1 length1 = -1 length2 = -1 num6 = 0 while (len(formatStr) > num6): chr = formatStr[num6] if (chr == 'D'): if (strS != None): return None # throw new ArgumentException("formatStr"); strS = "0" num6 += 1 flag = False while (len(formatStr) > num6): if (formatStr[num6] != 'D'): if (formatStr[num6] != '.'): break strS = String.Concat([strS, "."]) flag = True num6 += 1 else: strS = String.Concat([strS, "0"]) if (flag): num3 += 1 num6 += 1 length = stringBuilder.Length elif (chr == 'M'): if (strS == None): return None # throw new ArgumentException("formatStr"); if (str1 != None): return None # throw new ArgumentException("formatStr"); str1 = "0" num6 += 1 flag1 = False while (len(formatStr) > num6): if (formatStr[num6] != 'M'): if (formatStr[num6] != '.'): break str1 = String.Concat([str1, "."]) flag1 = True num6 += 1 else: str1 = String.Concat([str1, "0"]) if (flag1): num4 += 1 num6 += 1 length1 = stringBuilder.Length elif (chr == 'S'): if (strS == None): return None # throw new ArgumentException("formatStr"); if (str1 == None): return None # throw new ArgumentException("formatStr"); if (str2 != None): return None # throw new ArgumentException("formatStr"); str2 = "0" num6 += 1 flag2 = False while (len(formatStr) > num6): if (formatStr[num6] != 'S'): if (formatStr[num6] != '.'): break str2 = String.Concat([str2, "."]) flag2 = True num6 += 1 else: str2 = String.Concat([str2, "0"]) if (flag2): num5 += 1 num6 += 1 length2 = stringBuilder.Length elif (chr == 'H'): if (self.type == DegreesType.Latitude): if (self.value >= 0): stringBuilder.Append("N") else: stringBuilder.Append("S") elif (self.type == DegreesType.Longitude or self.type == DegreesType.Variation): if (self.value >= 0): stringBuilder.Append("E") else: stringBuilder.Append("W") num6 += 1 elif (chr != '-'): stringBuilder.Append(chr) num6 += 1 else: if (self.value < 0): stringBuilder.Append("-") num6 += 1 if (str2 != None): num = math.fabs(self.value) if (not math.isinf(self.value)) else 0 num7 = math.trunc(num) num8 = (num - num7) * 60 num9 = math.trunc(num8) num10 = round((num8 - num9) * 60, num5) if (num10 >= 60): num10 = num10 - 60 num9 = num9 + 1 if (num9 >= 60): num9 = num9 - 60 num7 = num7 + 1 stringBuilder.Insert(length2, String.Number2String(num10, str2)) stringBuilder.Insert(length1, String.Number2String(num9, str1)) stringBuilder.Insert(length, String.Number2String(num7, strS)) elif (str1 == None): if (strS == None): return None # throw new ArgumentException("formatStr"); num2 = math.fabs(self.value) if (not math.isinf(self.value)) else 0 num11 = round(num2, num3) stringBuilder.Insert(length, String.Number2String(num11, strS)) else: num1 = math.fabs(self.value) if (not math.isinf(self.value)) else 0 num12 = math.trunc(num1) num13 = round((num1 - num12) * 60, num4) if (num13 >= 60): num13 = num13 - 60 num12 = num12 + 1 stringBuilder.Insert(length1, String.Number2String(num13, str1)) stringBuilder.Insert(length, String.Number2String(num12, strS)) return stringBuilder.ToString()
def method_5(self): stringBuilder = StringBuilder() self.method_6(stringBuilder, None, True, True) return stringBuilder.ToString()
def ToString(self): stringBuilder = StringBuilder() self.method_9(stringBuilder, None) return stringBuilder.ToString()
def method_14(self, string_0, int_0, int_1): str0 = ""; stringBuilder = StringBuilder(); strArrays = Extensions.smethod_4(string_0); for i in range(len(strArrays) - 1): str1 = strArrays[i]; for case in switch (self.tableType): if case(QATableType.General): stringBuilder.Append("<td>{0}</td>".format(self.method_13(str1, True))); break; elif case(QATableType.OCAH): if (int_0 == 0 or i == 0): stringBuilder.Append("<th>{0}</th>".format(self.method_13(str1, False))); break; else: stringBuilder.Append("<td>{0}</td>".format(self.method_13(str1, False))); break; elif case(QATableType.ObstacleList): if (int_0 != 0): stringBuilder.Append("<td>{0}</td>".format(self.method_13(str1, False))); break; else: stringBuilder.Append("<th>{0}</th>".format(self.method_13(str1, False))); break; str0 = "<br>" if(len(strArrays) <= 0) else strArrays[len(strArrays) - 1]; for case in switch (self.tableType): if case(QATableType.General): if (len(strArrays) == 1 and int_1 > 1): num = str0.smethod_6(); if (num < 4): str0 = "<b>{0}</b>".format(str0); elif (num < 8): str0 = "<b><i>{0}</i></b>".format(str0); if (len(strArrays) >= int_1): stringBuilder.Append("<td>{0}</td>".format(self.method_13(str, True))); break; else: int1 = int_1 - len(strArrays) + 1; stringBuilder.Append("<td colspan=\"{0}\">{1}</td>".format(str(int1), self.method_13(str, True))); break; elif case(QATableType.OCAH): if (int_0 != 0): if (len(strArrays) == 1): stringBuilder.Append("<th>{0}</th>".format(self.method_13(str, False))); for j in range(len(strArrays), int_1): stringBuilder.Append("<td><br></td>"); break; stringBuilder.Append("<td>{0}</td>".format(self.method_13(str, False))); stringBuilder.Append("<th>{0}</th>".format(self.method_13(str, False))); for j in range(len(strArrays), int_1): stringBuilder.Append("<td><br></td>"); break; elif case(QATableType.ObstacleList): if (int_0 != 0): stringBuilder.Append("<td>{0}</td>".format(self.method_13(str, False))); else: stringBuilder.Append("<th>{0}</th>".format(self.method_13(str, False))); for k in range(len(strArrays), int_1): stringBuilder.Append("<td><br></td>"); break; return stringBuilder.ToString();