Exemple #1
0
 def __init__(self, modsql, title, parent):
     super(DBloadingGui, self).__init__(parent)
     self.setupUi(self)
     self.parent = parent
     self.setWindowFlags(Qt.WindowStaysOnTopHint)
     self.setWindowFlags(Qt.SplashScreen)
     centerWidget(self)
     # font
     font = QFont()
     font.setFamily(self.FONT_MAI)
     font.setFixedPitch(True)
     font.setPointSize(14)
     self.lab_text.setFont(font)
     self.tabWidget.currentChanged.connect(self.chgtLogo)
     # logo gif
     self.numlogo = 1
     self.movielogo = QMovie(path.join(self.RESS_LOGO, "logo1.gif"))
     self.lab_logo.setMovie(self.movielogo)
     self.movielogo.start()
     # tab1
     req = DBFuncBase().buildReqTCD("CATEGORY", "FAMILY", "ALBUMS", "ALBUM",
                                    "1", True, modsql)
     self.buildTab(req, self.tableWid1)
     # tab2
     req = DBFuncBase().buildReqTCD("CATEGORY", "FAMILY", "ALBUMS",
                                    "SIZE (GO)", "ROUND( `Size` /1024,1)",
                                    True, modsql)
     self.buildTab(req, self.tableWid2)
     # tab3
     req = DBFuncBase().buildReqTCD("YEAR", "CATEGORY", "ALBUMS", "YEAR",
                                    "1", True, modsql)
     self.buildTab(req, self.tableWid3)
     # message
     basedate = DBFuncBase().sqlToArray(getrequest('datedatabase', modsql))
     if len(basedate) == 0:
         txt_message = modsql + " Base \nlast modified :\nnever"
     elif isinstance(basedate[0], QDateTime):
         txt_message = modsql + " Base \nlast modified :\n" + basedate[
             0].toString('dd/MM/yyyy hh:mm:ss')
     else:
         txt_message = modsql + " Base \nlast modified :\n" + basedate[
             0].replace('T', ' ')
     self.lab_text.setText(title + "\nConnected " + txt_message)
     # quit
     self.btn_quit.clicked.connect(lambda: self.hide())
     # theme
     self.applyTheme()
Exemple #2
0
 def __init__(self, cover, namealbum, w, h, parent=None):
     super(CoverViewGui, self).__init__(parent)
     self.resize(w, h)
     self.setMaximumSize(w, h)
     self.setMinimumSize(cover.width(), cover.height())
     self.setWindowFlags(Qt.WindowStaysOnTopHint)
     self.setWindowFlags(Qt.WindowTitleHint)
     self.setWindowFlags(Qt.WindowSystemMenuHint)
     self.setWindowFlags(Qt.WindowCloseButtonHint)
     self.setWindowIcon(QIcon(WINS_ICO))
     centerWidget(self)
     self.namealbum = namealbum
     self.cover = cover
     self.label = QLabel(self)
     self.resizeEvent(None)
     self.label.mousePressEvent = lambda e: self.destroy()
     posit = QGridLayout(self)
     posit.setContentsMargins(0, 0, 0, 0)
     posit.addWidget(self.label, 0, 0)
     self.setLayout(posit)
     self.show()
Exemple #3
0
    def __init__(self,
                 pathartworks,
                 nametittle,
                 createcover,
                 w,
                 h,
                 sizeTN,
                 parent=None):
        super(ArtworksGui, self).__init__(parent)
        self.resize(w, h)
        self.setWindowIcon(QIcon(WINS_ICO))
        self.setWindowTitle(TITL_PROG +
                            " [view ArtWorks] : reading files covers...")
        self.setStyleSheet(
            'QWidget{background-color: darkgray} '
            'QLabel{background-color: black;border: 1px solid black;}')

        # cover default
        self.mycover = None
        self.numpic = 0

        self.line = 1
        self.sizeTN = sizeTN
        self.thunbnails = DBThunbnails(self, self.sizeTN, self.line)
        self.thunbnails.signalthunchgt.connect(self.onSelectCover)
        self.thunbnails.setMaximumSize(QSize(16667, sizeTN + 4))
        self.labelcover = QLabel(self)
        self.labelcover.setAlignment(Qt.AlignCenter)
        self.labelcover.setMinimumSize(
            QSize(self.width() - 40, h - (self.line * (self.sizeTN + 4)) - 70))
        self.labelcover.setContextMenuPolicy(Qt.CustomContextMenu)
        self.labelcover.customContextMenuRequested.connect(self.popUpMenu)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.labelcover.setSizePolicy(sizePolicy)
        self.labelcover.enterEvent = self.selectCover

        # popup albums
        self.menua = QMenu()
        self.action_OFC = self.menua.addAction(
            "Open Folder...", lambda c=pathartworks: openFolder(c))
        self.action_COV = self.menua.addAction("Create cover file...",
                                               self.createFileCover)

        # create cover option only if no cover file
        if createcover[0:len(TEXT_NCO)] != TEXT_NCO:
            self.action_COV.setEnabled(False)

        layout = QVBoxLayout(self)

        lyaout = QGridLayout(self)
        lyaout.addWidget(self.thunbnails)
        lyaout.setContentsMargins(0, 0, 0, 0)
        lyaout.setSpacing(0)

        layout.addLayout(lyaout)
        layout.addWidget(self.labelcover)
        layout.setSpacing(5)
        layout.setContentsMargins(7, 7, 7, 7)
        self.setLayout(layout)
        centerWidget(self)
        self.show()

        # build list covers
        self.nametittle = nametittle
        self.fileslist = list(getListFiles(pathartworks, MASKCOVER))
        self.filelist = self.fileslist[0]

        # build thunbnails
        self.thunbnails.addthunbails(self.fileslist, self.sizeTN, True, 0, 100,
                                     len(self.fileslist))

        # build large cover
        self.displayCover(self.numpic)
Exemple #4
0
    def __init__(self,
                 list_albums,
                 list_columns,
                 list_category,
                 typeupdate,
                 modsql,
                 envt,
                 themecolor,
                 parent=None):
        """Init Gui, start invent"""
        super(InventGui, self).__init__(parent)
        self.setupUi(self)
        self.resize(self.WIDT_MAIN, self.HEIG_MAIN - 300)
        self.setWindowIcon(QIcon(self.WINS_ICO))
        self.setWindowTitle(self.TITL_PROG + " Environment : " + envt +
                            " mode : " + typeupdate)
        centerWidget(self)

        self.parent = parent
        self.list_albums = list_albums
        self.list_category = list_category
        self.list_columns = list_columns
        self.modsql = modsql
        self.envits = envt
        self.typeupdate = typeupdate
        self.curthe = themecolor
        self.logname = QDateTime.currentDateTime().toString(
            'yyMMddhhmmss') + "_UPDATE_DATABASE_" + self.envits + ".log"
        self.logname = path.join(self.LOGS_PROG, self.logname)
        self.total_p = None
        self.albumnew = 0
        self.alupdate = 0
        self.aldelete = 0
        self.apresent = 0
        self.actionerror = 0
        self.selecttrowg = 0
        self.list_actions = []

        font = QFont()
        font.setFamily("Courrier New")
        font.setFixedPitch(True)
        font.setPointSize(10)
        fontconsol = QFont()
        fontconsol.setFamily(self.FONT_CON)
        fontconsol.setFixedPitch(True)
        fontconsol.setPointSize(8)
        self.levelcolors = [Qt.white, Qt.green, Qt.magenta, Qt.red]

        self.menua = QMenu()
        self.action_OPF = self.menua.addAction(
            self.style().standardIcon(QStyle.SP_DialogOpenButton),
            "Open Folder...", self.getFolder)

        self.lab_result.setFont(font)
        self.lab_release.setFont(font)
        self.lab_advance.setFont(font)
        self.lab_releaseadvance.setFont(font)

        self.textEditrelease.setStyleSheet(
            "background-color: black;color:white;")
        self.textEditrelease.setLineWrapMode(QTextEdit.NoWrap)
        self.textEditrelease.setReadOnly(True)
        self.textEditrelease.setFont(fontconsol)
        self.vScrollBar = QScrollBar(self.textEditrelease.verticalScrollBar())
        self.vScrollBar.sliderPressed.connect(self.onScrollPressed)

        self.btn_action.clicked.connect(self.realiseActions)
        self.btn_action.setEnabled(False)
        self.btn_quit.clicked.connect(self.closeImport)
        self.lcdTime.setSegmentStyle(QLCDNumber.Flat)

        self.seconds = 0
        self.myThreadtime = myThreadTimer(self)
        self.myThreadtime.timeElapsed.connect(self.showlcd)
        self.myThreadtime.start()

        self.tbl_update.setContextMenuPolicy(Qt.CustomContextMenu)
        self.tbl_update.customContextMenuRequested.connect(
            self.popUpTreeUpdate)
        self.tableMdlUpd = ModelTableUpdatesABS(self, [[] * 5])
        self.tbl_update.setModel(self.tableMdlUpd)
        for i in range(len(self.tableMdlUpd.U_C_WIDTH)):
            self.tbl_update.setColumnWidth(i, self.tableMdlUpd.U_C_WIDTH[i])
        self.tbl_update.verticalHeader().setDefaultSectionSize(
            self.tableMdlUpd.C_HEIGHT)
        self.tbl_update.horizontalHeader().setStretchLastSection(True)

        self.applyTheme()
        self.show()
Exemple #5
0
    def __init__(self, parent=None):
        super(DBAlbumsQT5Mini, self).__init__(parent)
        self.setWindowIcon(QIcon(self.WINS_ICO))
        self.setWindowTitle(self.TITL_PROG + ' : [' + self.ENVT_DEF + ']')
        self.h_main = 400
        self.resize(1248, self.h_main)
        centerWidget(self)

        self.menua = QMenu()
        self.action_OPF = self.menua.addAction(
            self.style().standardIcon(QStyle.SP_DialogOpenButton),
            "Open Folder...", self.getFolder)

        self.textsearch = QLineEdit()
        self.textsearch.setFixedSize(170, 22)
        self.statusBar().addPermanentWidget(self.textsearch)
        self.textsearch.textChanged.connect(self.onFiltersChanged)

        self.btn_style = QPushButton()
        self.btn_style.setIcon(self.style().standardIcon(
            QStyle.SP_DialogResetButton))
        self.btn_style.setStyleSheet("border: none;")
        self.btn_style.clicked.connect(
            lambda: [self.curthe.nextTheme(),
                     self.applyTheme()])
        self.statusBar().addPermanentWidget(self.btn_style)

        boolconnect, self.dbbase, self.modsql, self.rootDk, self.lstcat = connectDatabase(
            self.ENVT_DEF)

        autoList = DBFuncBase().sqlToArray(
            getrequest('autocompletion', self.modsql))
        self.com_autcom = QCompleter(autoList, self.textsearch)
        self.com_autcom.setCaseSensitivity(Qt.CaseInsensitive)
        self.textsearch.setCompleter(self.com_autcom)

        self.mytable = QTableView(self)
        self.mytable.setAlternatingRowColors(True)
        self.mytable.setSortingEnabled(True)
        self.mytable.setSelectionBehavior(QTableView.SelectRows)
        self.mytable.setSelectionMode(QAbstractItemView.SingleSelection)
        self.mytable.doubleClicked.connect(self.onSelect)
        self.mytable.setContextMenuPolicy(Qt.CustomContextMenu)
        self.mytable.customContextMenuRequested.connect(self.popUpTreeAlbums)

        self.curthe = ThemeColors(self.THEM_COL)
        self.applyTheme()

        req = getrequest('albumslist', self.modsql)
        self.model = ModelTableAlbumsABS(self, req)
        self.model.SortFilterProxy.layoutChanged.connect(self.listChanged)
        self.model.SortFilterProxy.sort(-1)
        self.mytable.setModel(self.model.SortFilterProxy)

        # width columns
        for ind in range(len(self.model.A_C_WIDTH)):
            self.mytable.setColumnWidth(ind, self.model.A_C_WIDTH[ind])
        # height rows
        self.mytable.verticalHeader().setDefaultSectionSize(
            self.model.C_HEIGHT)

        self.displayTitle()
        self.setCentralWidget(self.mytable)