def setUi ( self ): """Username""" username = "******" icon = utils.getIconPath( "admin" ) self.label_username.setText ( "DB user" ) self.labelpixmap_username.setPixmap ( icon ) self.lineEdit_username.setText ( username ) """Password""" password = "******" icon = utils.getIconPath( "password" ) self.labelPassword.setText ( "DB password" ) self.labelPixmapPassword.setPixmap ( icon ) self.lineEditPassword.setText ( password ) """DB adress""" adress = "127.0.0.1:5984" icon = utils.getIconPath( "adress" ) self.label_adress.setText ( "DB adress" ) self.labelpixmap_adress.setPixmap ( icon ) self.lineEdit_adress.setText ( adress ) """host Username""" username = "******" icon = utils.getIconPath( "admin" ) self.label_husername.setText ( "Host user" ) self.labelpixmap_husername.setPixmap ( icon ) self.lineEdit_husername.setText ( username ) """host adress""" hadress = "127.0.0.1" icon = utils.getIconPath( "adress" ) self.label_hadress.setText ( "Host adress" ) self.labelpixmap_hadress.setPixmap ( icon ) self.lineEdit_hadress.setText ( hadress ) """Homework root""" root = "volume1" icon = utils.getIconPath( "hierarchy" ) self.label_root.setText ( "Host root" ) self.lineEdit_root.setText ( root ) self.labelpixmap_root.setPixmap ( icon ) """project""" project = "prj" icon = utils.getIconPath( "project" ) self.label_project.setText( "Project slug" ) self.labelpixmap_project.setPixmap( icon ) self.lineEdit_project.setText( project ) """Version""" icon = utils.getIconPath( "hktitle16x16" ) self.label_version.setText ( "Badass" ) self.labelpixmap_version.setPixmap ( icon ) self.comboBoxVersions.addItems( utils.getBadassVersions() ) """Create""" self.pushButton_create.setEnabled ( False ) self.pushButton_create.setIcon ( QtGui.QIcon ( utils.getIconPath( "add" ) ) )
def retranslateUi(self): # Title self.setWindowTitle(QtGui.QApplication.translate("Breakdown", "Breakdown", None, QtGui.QApplication.UnicodeUTF8)) self.labelTitle.setText(QtGui.QApplication.translate("Breakdown", "<html><head/><body><p><span style=\" font-size:12pt; font-weight:600;\">Project</span><span style=\" font-size:12pt;\"/><span style=\" font-size:12pt; font-weight:600;\">:</span><span style=\" font-size:12pt;\"> %s</span></p></body></html>"%(self.project), None, QtGui.QApplication.UnicodeUTF8)) self.labelAssetSearch.setText(QtGui.QApplication.translate("Breakdown", "searchAssets", None, QtGui.QApplication.UnicodeUTF8)) icon=QtGui.QIcon(utils.getIconPath("refresh")) self.pushButtonAssetRefresh.setIcon(icon) self.treeWidgetAsset.setSortingEnabled(True) self.treeWidgetAsset.headerItem().setText(0, QtGui.QApplication.translate("Breakdown", "Assets", None, QtGui.QApplication.UnicodeUTF8)) __sortingEnabled=self.treeWidgetAsset.isSortingEnabled() self.treeWidgetAsset.setSortingEnabled(False) self.treeWidgetAsset.topLevelItem(0).setText(0, QtGui.QApplication.translate("Breakdown", "asset", None, QtGui.QApplication.UnicodeUTF8)) self.treeWidgetAsset.setSortingEnabled(__sortingEnabled) self.labelPackFilter.setText(QtGui.QApplication.translate("Breakdown", "searchPacks", None, QtGui.QApplication.UnicodeUTF8)) icon=QtGui.QIcon(utils.getIconPath("link")) self.pushButtonPackLink.setIcon(icon) icon=QtGui.QIcon(utils.getIconPath("unlink")) self.pushButtonPackUnlink.setIcon(icon) icon=QtGui.QIcon(utils.getIconPath("add")) self.pushButtonPackAdd.setIcon(icon) icon=QtGui.QIcon(utils.getIconPath("subtract")) self.pushButtonPackDisable.setIcon(icon) icon=QtGui.QIcon(utils.getIconPath("settings")) self.pushButtonPackSettings.setIcon(icon) self.treeWidgetPack.setSortingEnabled(True) self.treeWidgetPack.headerItem().setText(0, QtGui.QApplication.translate("Breakdown", "Packs", None, QtGui.QApplication.UnicodeUTF8)) __sortingEnabled=self.treeWidgetPack.isSortingEnabled() self.treeWidgetPack.setSortingEnabled(False) self.treeWidgetPack.topLevelItem(0).setText(0, QtGui.QApplication.translate("Breakdown", "pack", None, QtGui.QApplication.UnicodeUTF8)) self.treeWidgetPack.setSortingEnabled(__sortingEnabled) self.labelShotFilter.setText(QtGui.QApplication.translate("Breakdown", "searchShots", None, QtGui.QApplication.UnicodeUTF8)) icon=QtGui.QIcon(utils.getIconPath("link")) self.pushButtonShotLink.setIcon(icon) icon=QtGui.QIcon(utils.getIconPath("unlink")) self.pushButtonShotUnlink.setIcon(icon) self.treeWidgetShot.setSortingEnabled(True) self.treeWidgetShot.headerItem().setText(0, QtGui.QApplication.translate("Breakdown", "Shots", None, QtGui.QApplication.UnicodeUTF8)) __sortingEnabled=self.treeWidgetShot.isSortingEnabled() self.treeWidgetShot.setSortingEnabled(False) self.treeWidgetShot.topLevelItem(0).setText(0, QtGui.QApplication.translate("Breakdown", "shot", None, QtGui.QApplication.UnicodeUTF8)) self.treeWidgetShot.setSortingEnabled(__sortingEnabled)
def refreshProject ( self, serveradress ): """If server exist set 'ok' icon """ self.server = False if utils.serverExists ( serveradress ) : icon = utils.getIconPath( "ok" ) self.server = utils.getServer ( serveradress ) """Clear current comboBox_project list""" self.comboBox_project.clear () icon = utils.getIconPath( "cross" ) self.projects = ["No project available"] if utils.serverExists ( serveradress ) : projects = core.lsProjectServer ( serveradress ) if len ( projects ) > 0 : self.projects = projects self.comboBox_project.addItems ( self.projects ) root = self.lineEdit_root.text() root = os.path.join ( root, "projects" ) for i in range ( 0, self.comboBox_project.count () ): proj = self.comboBox_project.itemText ( i ) curroot = os.path.join ( root, proj ) if proj == "No project available" or os.path.exists ( curroot ) : icon = utils.getIconPath( "cross" ) self.project_stat [ proj ] = False else: icon = utils.getIconPath( "ok" ) self.project_stat [ proj ] = True self.comboBox_project.setItemIcon ( i, QtGui.QIcon ( icon ) ) self.pushButton.setEnabled ( self.project_stat [ self.comboBox_project.currentText () ] )
def buildTable ( self ): count = 0 """Setup the items fonts""" font = QtGui.QFont () font.setPointSize ( 10 ) font.setWeight ( 75 ) font.setItalic ( False ) font.setBold ( True ) for path in self.paths : doc_id = self.getDocIdFromPath ( path ) current_version = self.getVersionFromPath ( path ) versions = self.getVersionsList ( doc_id ) comboBox = QtGui.QComboBox () comboBox.doc = self.db [ doc_id ] comboBox.addItems ( versions ) comboBox.setCurrentIndex ( comboBox.findText ( current_version ) ) comboBox.activated.connect ( self.comboxChanged ) comboBox.versions = versions comboBox.path = path if current_version == versions [ -1 ] : bg_color = QtGui.QColor ( 128, 255, 128 ) else: bg_color = QtGui.QColor ( 255, 128, 128 ) item = QtGui.QTableWidgetItem ( doc_id ) item.setForeground ( QtGui.QBrush ( QtGui.QColor ( 0, 0, 0 ) ) ) item.setIcon( QtGui.QIcon ( utils.getIconPath( core.getTypeFromId ( doc_id ) ) ) ) item.setFlags ( QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled ) item.setBackground ( bg_color ) item.setFont ( font ) comboBox.docItem = item self.tableWidget.setCellWidget ( count, 0, comboBox ) self.tableWidget.setItem ( count, 1, item ) count += 1
def setUi ( self ): """Username""" username = "******" icon = utils.getIconPath( "admin" ) self.label_username.setText ( "DB user" ) self.labelpixmap_username.setPixmap ( icon ) self.lineEdit_username.setText ( username ) """Password""" password = "******" icon = utils.getIconPath( "password" ) self.label_password.setText ( "DB password" ) self.labelpixmap_password.setPixmap ( icon ) self.lineEdit_password.setText ( password ) """DB adress""" adress = "127.0.0.1:5984" icon = utils.getIconPath( "adress" ) self.label_adress.setText ( "DB adress" ) self.labelpixmap_adress.setPixmap ( icon ) self.lineEdit_adress.setText ( adress ) """DB project""" icon = utils.getIconPath( "refresh" ) self.label_project.setText ( "DB project" ) self.refresh.setIcon ( QtGui.QIcon ( icon ) ) """Homework root""" root = "/homeworks" icon = utils.getIconPath( "hierarchy" ) self.label_root.setText ( "Project root" ) self.lineEdit_root.setText ( root ) self.lineEdit_root.setReadOnly ( True ) self.labelpixmap_root.setPixmap ( icon ) """Description""" icon = utils.getIconPath( "pull" ) self.label_4.setText ( "Description" ) self.plainTextEdit.setPlainText ( "This is the project" ) self.pushButton.setText ( "Synchronize" ) self.pushButton.setIcon ( QtGui.QIcon ( icon ) ) self.project_stat = dict () self.project_stat [ "No project available" ] = False self.project_stat [ "" ] = False self.refreshClicked () self.projectChanged()
def updateInfos ( self, comboBox ): current_version = comboBox.currentText () doc_id = comboBox.doc.id ver = str ( int ( current_version ) ) versions = comboBox.doc [ "review" ] path = versions [ ver ]["path" ] if current_version == comboBox.versions [ -1 ] : bg_color = QtGui.QColor ( 128, 255, 128 ) else: bg_color = QtGui.QColor ( 255, 128, 128 ) comboBox.docItem.setBackground ( bg_color ) """Set the data to the plain text""" creator = "Creator:\t%s\n" % versions [ ver ] [ 'creator' ] created = "\nCreated:\t%s\n" % versions [ ver ] [ 'created' ] description = "\nDescription:\n\t%s\n" % versions [ ver ] [ 'description' ] pathinfo = "\nPath:\n\t%s\n" % os.path.expandvars( versions [ ver ] [ "path" ] ) files = "\n\t".join ( map ( str, versions [ ver ] [ "files" ] ) ) files = "\nFiles:\n\t%s\n" % files infos = creator + created + description + pathinfo + files self.plainTextEdit_description.setPlainText ( infos ) """Set the screenshot""" screenshot = "%s.jpg" % doc_id screenshot = os.path.join( path, screenshot ) if not os.path.exists ( screenshot ) : screenshot = utils.getIconPath( "hk_title_medium" ) self.labelImage.setPixmap( screenshot )
def __init__( self, fpath = "", parent = None ): super ( UiCheckDependencies, self ).__init__( parent ) self.fpath = fpath self.paths = self.getPaths () self.db = utils.getDb () self.setObjectName( "MainWindow" ) self.resize ( 642, 726 ) self.centralwidget = QtGui.QWidget ( self ) self.centralwidget.setObjectName( "centralwidget" ) self.horizontalLayout_2 = QtGui.QHBoxLayout( self.centralwidget ) self.horizontalLayout_2.setObjectName( "horizontalLayout_2" ) self.verticalLayout_main = QtGui.QVBoxLayout() self.verticalLayout_main.setObjectName( "verticalLayout_main" ) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName( "horizontalLayout" ) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setSizeConstraint( QtGui.QLayout.SetDefaultConstraint ) self.verticalLayout.setObjectName( "verticalLayout" ) self.horizontalLayout_6 = QtGui.QHBoxLayout() self.horizontalLayout_6.setObjectName( "horizontalLayout_6" ) self.label_sys = QtGui.QLabel( self.centralwidget ) self.label_sys.setMaximumSize( QtCore.QSize( 21, 16777215 ) ) self.label_sys.setObjectName( "label_sys" ) self.horizontalLayout_6.addWidget( self.label_sys ) self.label_proj = QtGui.QLabel( self.centralwidget ) self.label_proj.setObjectName( "label_proj" ) self.horizontalLayout_6.addWidget( self.label_proj ) self.verticalLayout.addLayout( self.horizontalLayout_6 ) self.horizontalLayout.addLayout( self.verticalLayout ) self.verticalLayout_2 = QtGui.QVBoxLayout() self.verticalLayout_2.setObjectName( "verticalLayout_2" ) self.labelImage = QtGui.QLabel( self.centralwidget ) self.labelImage.setMinimumSize( QtCore.QSize( 300, 300 ) ) self.labelImage.setText( "" ) self.labelImage.setObjectName( "labelImage" ) self.verticalLayout_2.addWidget( self.labelImage ) self.plainTextEdit_description = QtGui.QPlainTextEdit( self.centralwidget ) self.plainTextEdit_description.setEnabled ( False ) self.plainTextEdit_description.setPlainText( "" ) self.plainTextEdit_description.setObjectName ( "plainTextEdit_description" ) self.verticalLayout_2.addWidget( self.plainTextEdit_description ) self.horizontalLayout.addLayout( self.verticalLayout_2 ) self.verticalLayout_main.addLayout( self.horizontalLayout ) self.horizontalLayout_2.addLayout( self.verticalLayout_main ) self.setCentralWidget( self.centralwidget ) self.statusbar = QtGui.QStatusBar( self ) self.statusbar.setObjectName( "statusbar" ) self.setStatusBar( self.statusbar ) self.setWindowTitle( "Check Dependencies" ) self.label_sys.setPixmap ( utils.getIconPath( self.launcher ) ) self.label_proj.setText( """<html><head/><body><p><span style=\" font-size:12pt; font-weight:600;\">Asset Updater </span><span style=\" font-size:12pt; \"/><span style=\" font-size:12pt;font-weight:600; \">:</span><span style=\" font-size:12pt; \"> '%s'</span></p></body></html>""" % ( os.getenv ( "HK_PROJECT" ) ) ) self.tableWidget = QtGui.QTableWidget ( len ( self.paths ), 2 ) self.tableWidget.setHorizontalScrollBarPolicy ( QtCore.Qt.ScrollBarAlwaysOff ) self.tableWidget.setAlternatingRowColors ( True ) self.tableWidget.horizontalHeader().setStretchLastSection ( True ) self.tableWidget.horizontalHeader().setMinimumSectionSize ( 200 ) self.tableWidget.verticalHeader().hide () self.tableWidget.horizontalHeader().hide () self.tableWidget.setSelectionMode ( QtGui.QAbstractItemView.SingleSelection ) self.tableWidget.resizeColumnToContents ( True ) self.tableWidget.setMouseTracking ( False ) self.verticalLayout.addWidget( self.tableWidget ) self.tableWidget.itemClicked.connect ( self.tableClicked ) self.tableWidget.cellClicked.connect ( self.comboxChanged ) self.horizontalLayout_3 = QtGui.QHBoxLayout() self.horizontalLayout_3.setObjectName( "horizontalLayout_3" ) spacerItem1 = QtGui.QSpacerItem( 40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum ) self.horizontalLayout_3.addItem( spacerItem1 ) self.pushButton_2 = QtGui.QPushButton( self.centralwidget ) self.pushButton_2.setFixedSize ( QtCore.QSize ( 80, 27 ) ) self.pushButton_2.setObjectName( "pushButton_2" ) self.horizontalLayout_3.addWidget( self.pushButton_2 ) self.pushButton = QtGui.QPushButton( self.centralwidget ) self.pushButton.setFixedSize( QtCore.QSize ( 60, 27 ) ) self.pushButton.setObjectName( "pushButton" ) self.horizontalLayout_3.addWidget( self.pushButton ) self.verticalLayout.addLayout( self.horizontalLayout_3 ) self.pushButton_2.setText ( "Update All" ) self.pushButton_2.setIcon ( QtGui.QIcon ( utils.getIconPath( "refresh" ) ) ) self.pushButton_2.clicked.connect ( self.updateAllClicked ) self.pushButton.clicked.connect ( self.doneClicked ) self.pushButton.setText ( "Done" ) self.pushButton.setIcon ( QtGui.QIcon ( utils.getIconPath( "done" ) ) ) self.buildTable() QtCore.QMetaObject.connectSlotsByName( self )