Best Python code snippet using pyatom_python
SearchTab.py
Source:SearchTab.py
1import datetime2from PyQt5.QtCore import Qt, QDate3from PyQt5.QtGui import QFont4from PyQt5.QtWidgets import QWidget, QPushButton, QDateEdit, QComboBox, QTableWidgetItem, QTableWidget, QDesktopWidget, \5 QLineEdit, QLabel6from service.CommonService import getComboData_select7from service.SlipSearchService import SearchDataByPeriod8from window.sub.InsertWindow import InsertWindow9FIXED_WIDTH = 8510FIXED_HEIGHT = 2511class SearchTab(QWidget):12 def __init__(self):13 super().__init__()14 self.initUI()15 def initUI(self):16 # ================ ê°ê³ë¶ ì
ë ¥ë²í¼ ====================17 insert_btn = QPushButton("ê°ê³ë¶ ì
ë ¥í기", self)18 insert_btn.clicked.connect(self.main_open_insertWidget)19 insert_btn.resize(110, 30)20 insert_btn.move(565, 190)21 # ================== FRDATE ========================22 self.frdateEdit = QDateEdit(self)23 self.frdateEdit.setDate(24 datetime.date(year=QDate.currentDate().year(), month=QDate.currentDate().month(), day=1))25 self.frdateEdit.setDisplayFormat('yyyy/MM/dd')26 self.frdateEdit.setFont(QFont("malgun Gothic", 11))27 # self.frdateEdit.setButtonSymbols(QSpinBox.NoButtons)28 self.frdateEdit.move(15, 190)29 self.frdateEdit.setFixedWidth(105)30 self.frdateEdit.setFixedHeight(30)31 # ================== TODATE ========================32 self.todateEdit = QDateEdit(self)33 self.todateEdit.setDate(QDate.currentDate())34 self.todateEdit.setDisplayFormat('yyyy/MM/dd')35 self.todateEdit.setFont(QFont("malgun Gothic", 11))36 self.todateEdit.move(130, 190)37 self.todateEdit.setFixedWidth(105)38 self.todateEdit.setFixedHeight(30)39 # =================== 구ë¶ê° =======================40 self.usageCombo = self.getComboValue(QComboBox(self), "USAGE")41 self.usageCombo.move(245, 190)42 # =================== ìí =======================43 self.bankCombo = self.getComboValue(QComboBox(self), "BANK")44 self.bankCombo.move(345, 190)45 # =================== ê²°ì ìë¨ =======================46 self.wayCombo = self.getComboValue(QComboBox(self), "PAYWAY")47 self.wayCombo.move(445, 190)48 # ==================================================49 self.searchLabel = QLabel("ê²ìì´ ì
ë ¥ : ", self)50 self.searchLabel.resize(75, 30)51 self.searchLabel.move(245, 225)52 # ==================== ê²ìì´ =======================53 self.searchText = QLineEdit(self)54 self.searchText.move(345, 225)55 self.searchText.setFont(QFont("malgun Gothic", 11))56 self.searchText.setFixedWidth(185)57 self.searchText.setFixedHeight(30)58 # =================== ê²ìë²í¼ =======================59 search_btn = QPushButton("ê²ì", self)60 search_btn.clicked.connect(self.insertToTable)61 search_btn.resize(110, 30)62 search_btn.move(565, 225)63 self.mainTable = QTableWidget(self)64 self.tableHeader = ["ë ì§", "ì ì", "ì
ê¸", "ì¶ê¸", "í목", "ê²°ì ìë¨", "ìí"]65 self.mainTable.setColumnCount(len(self.tableHeader))66 self.mainTable.setHorizontalHeaderLabels(self.tableHeader)67 self.mainTable.resize(660, 450)68 self.mainTable.move(15, 260)69 self.insertToTable()70 # event def71 def main_open_insertWidget(self):72 sub = InsertWindow()73 sub.show()74 def getComboValue(self, combo, category):75 result = getComboData_select(category)76 for data in result:77 combo.addItem(data['name'], data['code'])78 combo.setMinimumHeight(FIXED_HEIGHT)79 combo.setFixedWidth(FIXED_WIDTH)80 combo.setFixedHeight(FIXED_HEIGHT)81 return combo82 def insertToTable(self):83 paramHeader = ['ymd', 'remark', 'input', 'output', 'usage', 'payway', 'bank']84 param = {85 'frdate': self.frdateEdit.text().replace("/", ""),86 'todate': self.todateEdit.text().replace("/", ""),87 'usage': ('' if self.usageCombo.currentData() == '-1' else self.usageCombo.currentData()),88 'bankcd': ('' if self.bankCombo.currentData() == '-1' else self.bankCombo.currentData()),89 'payway': ('' if self.wayCombo.currentData() == '-1' else self.wayCombo.currentData()),90 'search': '%' + self.searchText.text() + '%'91 }92 resultData = SearchDataByPeriod(param)93 self.mainTable.setRowCount(len(resultData))94 self.mainTable.setColumnCount(len(paramHeader))95 for i in range(len(resultData)):96 for j in range(len(paramHeader)):97 item = QTableWidgetItem(str(resultData[i][paramHeader[j]]))98 if j == 2 or j == 3:99 item.setTextAlignment(Qt.AlignVCenter | Qt.AlignRight)100 self.mainTable.setItem(i, j, item)101 self.mainTable.setColumnWidth(0, 70)102 self.mainTable.setColumnWidth(1, 200)103 self.mainTable.setColumnWidth(2, 70)104 self.mainTable.setColumnWidth(3, 80)105 self.mainTable.setColumnWidth(4, 70)106 self.mainTable.setColumnWidth(5, 60)...
AssetAssociationNodeDialog.py
Source:AssetAssociationNodeDialog.py
1# Licensed to the Apache Software Foundation (ASF) under one2# or more contributor license agreements. See the NOTICE file3# distributed with this work for additional information4# regarding copyright ownership. The ASF licenses this file5# to you under the Apache License, Version 2.0 (the6# "License"); you may not use this file except in compliance7# with the License. You may obtain a copy of the License at8#9# http://www.apache.org/licenses/LICENSE-2.010#11# Unless required by applicable law or agreed to in writing,12# software distributed under the License is distributed on an13# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY14# KIND, either express or implied. See the License for the15# specific language governing permissions and limitations16# under the License.17import sys18import gtk19from cairis.core.Borg import Borg20from cairis.core.ClassAssociationParameters import ClassAssociationParameters21from NDImplementationDecorator import NDImplementationDecorator22class AssetAssociationNodeDialog:23 def __init__(self,objt,environmentName,builder):24 self.window = builder.get_object("AssetAssociationNodeDialog")25 b = Borg()26 self.dbProxy = b.dbProxy27 self.theCurrentEnvironment = environmentName28 self.theHeadName = objt.name()29 self.decorator = NDImplementationDecorator(builder)30 assets = self.dbProxy.environmentAssets(self.theCurrentEnvironment) 31 associationTypes = ['Inheritance','Association','Aggregation','Composition','Dependency']32 multiplicityTypes = ['1','*','1..*']33 self.decorator.updateComboCtrl("assetAssociationHeadAdornmentCtrl",associationTypes,'')34 self.decorator.updateComboCtrl("assetAssociationHeadNryCtrl",multiplicityTypes,'')35 self.decorator.updateComboCtrl("assetAssociationTailNryCtrl",multiplicityTypes,'')36 self.decorator.updateComboCtrl("assetAssociationTailAdornmentCtrl",associationTypes,'')37 self.decorator.updateComboCtrl("assetAssociationTailNameCtrl",assets,'')38 self.decorator.updateButtonLabel("assetAssociationOkButton","Create")39 def on_assetAssociationOkButton_clicked(self,callback_data):40 headAdornment = self.decorator.getComboValue("assetAssociationHeadAdornmentCtrl")41 headNry = self.decorator.getComboValue("assetAssociationHeadNryCtrl")42 headRole = self.decorator.getText("assetAssociationHeadRoleCtrl")43 tailRole = self.decorator.getText("assetAssociationTailRoleCtrl")44 tailNry = self.decorator.getComboValue("assetAssociationTailNryCtrl")45 tailAdornment = self.decorator.getComboValue("assetAssociationTailAdornmentCtrl")46 tailName = self.decorator.getComboValue("assetAssociationTailNameCtrl")47 parameters = ClassAssociationParameters(self.theCurrentEnvironment,self.theHeadName,'asset',tailAdornment,tailNry,tailRole,headRole,headNry,headAdornment,'asset',tailName)48 self.dbProxy.addClassAssociation(parameters)49 self.window.destroy()50 def show(self):...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!