コード例 #1
0
    def move_files(self, files):
        common = CommonHelper()

        last_file_dir_relative_to = ''
        bytes_moved = 0
        files_moved = 0
        for file in files:
            if last_file_dir_relative_to != file.to.dir_relative:
                if last_file_dir_relative_to != '':
                    print('{} files moved. Total {}'.format(files_moved, common.size_human(bytes_moved)))
                    files_moved = 0
                    bytes_moved = 0
                print('{} => {}'.format(file.frm.dir_relative, file.to.dir_relative))

            files_moved += 1
            bytes_moved += file.frm.size()
            #print('\t - {} ({})'.format(file.frm.filename, file.frm.size_human()))
            # print(os.path.dirname(file.path_to))
            #pprint(file.__dict__)
            os.makedirs(file.to.dir, exist_ok=True)
            ## os.rename("path/to/current/file.foo", "path/to/new/destination/for/file.foo")
            ##shutil.copy2(file.frm.path, file.to.path)
            #print(file.frm.path, ' => ', file.to.path)
            shutil.move(file.frm.path, file.to.path)
            self.report_to_elastic(file)

            last_file_dir_relative_to = file.to.dir_relative
            #break

        print('{} files moved. Total {}'.format(files_moved, common.size_human(bytes_moved)))
        files_moved = 0
        bytes_moved = 0
        print ('########################################################')
コード例 #2
0
ファイル: LoadQSS.py プロジェクト: zstar2013/pyqt5
 def onClick(self):
     styleFile = "./style.qss"
     qssStyle = CommonHelper.readQSS(styleFile)
     win.setStyleSheet(qssStyle)
コード例 #3
0
        self.Frame1.listView.setItemDelegate(moduleDelegate)
        self.Frame1.refresh()
        #self.window.stackedWidget.addWidget(self.Frame1)
        self.upcomingFrame.setupUi(self.window.moduleFrame2)
        self.upcomingFrame.listView.setModel(upcomingModel)
        self.upcomingFrame.connectToRecord(self.window)
        self.window.stackedWidget.setCurrentIndex(0)

    def setupModel(self):
        # print(Login_View.userId)
        moduleName = dbController.GetTeacherInfo(Login_View.userId)
        # print(moduleName)
        for r in moduleName:
            self.moduleModel.listItemData.append(r[2])
            self.moduleList.append(r[2])
        #print(moduleModel.listItemData)
        self.Frame1.listView.setModel(self.moduleModel)
        return self.moduleModel.listItemData

    def goSession(self):
        # TODO: jump to the page
        self.enterSessionPage_Signal.emit()


# test code
if __name__ == "__main__":
    app = QApplication(sys.argv)
    mainWindow = modulePage_view()
    mainWindow.show()
    CommonHelper.readQSS("resources/qss/mainwindow.qss", app)
    sys.exit(app.exec_())
コード例 #4
0
from PyQt5.Qt import *
from Login_View import login_View
from Login_ctr import login_Ctr
import sys
from CommonHelper import CommonHelper

# The entry of program
if __name__ == "__main__":
    app = QApplication(sys.argv)
    loginWindow = login_View()
    loginCtr = login_Ctr()
    loginCtr.setView(loginWindow)
    CommonHelper.readQSS("/Users/liyiming/Desktop/GRP/GRP-P19/coding/GRP17-master-formal-version/resources/qss/login.qss",app)
    loginWindow.show()
    sys.exit(app.exec_())
コード例 #5
0
    def goToStudent(self, qModelIndex):
        # TODO: jump to the page

        print("go to " + str(qModelIndex.row()))
        self.enterStudentPage_SignalToPage.emit(str(qModelIndex.row()))

    def sort(self):
        #print(self.comboBox.currentText)
        print("sort")
        """
               Slot documentation goes here.
        """
        # TODO: not implemented yet

    def search(self):
        print(self.search_lineEdit.text())


# test code
if __name__ == "__main__":
    import sys
    from PyQt5.QtWidgets import QApplication
    app = QApplication(sys.argv)

    test = searchStudentFrame_view()
    model = searchStudentFrame_model()
    test.listView.setModel(model)
    test.show()
    CommonHelper.readQSS("resources/qss/searchStudentFrame.qss", app)
    sys.exit(app.exec_())
コード例 #6
0
 def style_Ubuntu(self):
     styleFile = './QSS-master/Ubuntu.qss'
     self.qssStyle = CommonHelper.readQSS(styleFile)
     self.qssStyleDia = CommonHelper.readQSS(styleFile)
     QMainWindow.setStyleSheet(self, self.qssStyle)
コード例 #7
0
 def style_MaterialDark(self):
     styleFile = './QSS-master/MaterialDark.qss'
     self.qssStyle = CommonHelper.readQSS(styleFile)
     self.qssStyleDia = CommonHelper.readQSS(styleFile)
     QMainWindow.setStyleSheet(self, self.qssStyle)
コード例 #8
0
    def ModuleDelete(self):
        print("ModuleDelete")

    def AttendanceDelete(self):
        print("AttendanceDelete")

    def AccountAdd(self):
        print("AccountAdd")

    def StudentAdd(self):
        print("StudentAdd")

    def TeacherAdd(self):
        print("TeacherAdd")

    def ModuleAdd(self):
        print("ModuleAdd")

    def AttendanceAdd(self):
        print("AttendanceAdd")


# test code
if __name__ == "__main__":
    app = QApplication(sys.argv)

    test = adminFrame_view()
    test.show()
    CommonHelper.readQSS("resources/qss/AdminFrame.qss", app)
    sys.exit(app.exec_())
コード例 #9
0
 def style_stand(self):
     styleFile = './QSS-master/style.qss'
     self.qssStyle = CommonHelper.readQSS(styleFile)
     self.qssStyleDia = CommonHelper.readQSS('./QSS-master/ElegantDark.qss')
     QMainWindow.setStyleSheet(self, self.qssStyle)
コード例 #10
0
                if len(start) <= 7:
                    start = "0" + start
                if r[2] == timer[0] and (start <= timer[1] and
                                         str(int(r[3]) + 2000000) > timer[1]):
                    self.Process_sessionModel.listItemData.append(session)
            elif category == "Future":
                if r[2] > timer[0] or (r[2] == timer[0] and r[3] >= timer[1]):
                    self.Future_sessionModel.listItemData.append(session)
            elif category == "Past":
                if r[2] < timer[0] or (r[2] == timer[0] and
                                       str(int(r[3]) + 2000000) <= timer[1]):
                    self.Past_sessionModel.listItemData.append(session)


# test code

if __name__ == "__main__":
    app = QApplication(sys.argv)

    mainWindow = QMainWindow()
    mainWindow.resize(800, 600)

    frame1 = QFrame(mainWindow)
    frame1.setGeometry(QtCore.QRect(0, 0, 300, 300))

    test = sessionFrame1_View()
    test.refresh()

    test.show()
    CommonHelper.readQSS("resources/qss/sessionFrameView.qss", app)
    sys.exit(app.exec_())
コード例 #11
0
ファイル: loadqss.py プロジェクト: PeterZhangxing/codewars
 def onClick(self):
     styleFile = './style.qss'
     qssStyle = CommonHelper.readQSS(styleFile)
     self.setStyleSheet(qssStyle)
コード例 #12
0
                    # if current is the greatest
                    if self.DateTime[len(self.DateTime) - 1] <= current:
                        #print('great   ' +str(self.DateTime[len(self.DateTime)-2])+"   "+str(current))
                        ModulePage_Ctr.ModulePage_ctr.sessionModel.listItemData.append(
                            r[0] + "  " + r[1] + "  " + r[3] + "  " + r[5] +
                            "  -  " + r[4])
                        break
                    # if the current is smaller than this one
                    if self.DateTime[inner] > current:
                        #print('insert  '+ str(current))
                        ModulePage_Ctr.ModulePage_ctr.sessionModel.listItemData.insert(
                            inner - 1, r[0] + "  " + r[1] + "  " + r[3] +
                            "  " + r[5] + "  -  " + r[4])
                        break
                    else:
                        continue


# test code
if __name__ == "__main__":
    app = QApplication(sys.argv)

    test = moduleFrame1_view()
    test.refresh()
    delegate = moduleFrame_Deletagte()
    model = moduleFrame1_Model()
    test.listView.setModel(model)
    test.listView.setItemDelegateForRow(0, delegate)
    test.show()
    CommonHelper.readQSS("resources/qss/Module.qss", app)
    sys.exit(app.exec_())
コード例 #13
0
ファイル: qt08_loadQss.py プロジェクト: kiorry/PYQT
    【简介】
	 加载QSS文件
     
"""
import sys
from PyQt5.QtWidgets import QMainWindow , QApplication,  QVBoxLayout , QPushButton
from CommonHelper import CommonHelper

class MainWindow(QMainWindow):
	def __init__(self,parent=None):
		super(MainWindow,self).__init__(parent)
		self.resize(477, 258) 
		self.setWindowTitle("加载QSS文件") 
		btn1 = QPushButton( self)  
		btn1.setText('添加')
		btn1.setToolTip('测试提示')
		vbox = QVBoxLayout()
		vbox.addWidget( btn1 )
      
		self.setLayout(vbox) 
       
if __name__ == "__main__": 
	app = QApplication(sys.argv)
	win = MainWindow()
    
	styleFile = './style.qss'
	qssStyle = CommonHelper.readQss( styleFile )	
	win.setStyleSheet( qssStyle ) 
	win.show()     
	sys.exit(app.exec_())
コード例 #14
0
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton
from CommonHelper import CommonHelper

if __name__ == '__main__':
    app = QApplication(sys.argv)
    win = QMainWindow()
    win.resize(477, 258)
    win.setWindowTitle("加载QSS文件")

    btn1 = QPushButton(win)
    btn1.setText("添加")
    btn1.setToolTip("测试提示")
    styleFile = './style.qss'
    #换肤时进行全局修改,只需修改不同的QSS文件即可
    style = CommonHelper.readQss(styleFile)
    win.setStyleSheet(style)
    win.show()
    sys.exit(app.exec_())
コード例 #15
0
ファイル: main.py プロジェクト: leeyiding/road_detection_pc
            row += 1
        self.rowCount = row

        db.close()

    def delData(self, row):
        db = QSqlDatabase.addDatabase('QSQLITE')
        db.setDatabaseName('./sql/sql.db')
        db.open()
        fileName = self.tableWidget.item(row, 0).text()
        self.tableWidget.removeRow(row)
        query = QSqlQuery()
        sqlCode = "delete from testing where fileName = '{}'".format(fileName)
        query.exec_(sqlCode)
        db.close
        os.remove('./sql/before/{}'.format(fileName))
        os.remove('./sql/after/{}'.format(fileName))


if __name__ == "__main__":
    app = QApplication(sys.argv)
    # 设置窗口图标
    app.setWindowIcon(QIcon('./resources/image/logo.jpg'))
    win = MainWindow()
    # 主窗口装载QSS
    styleFile = './style.qss'
    qssStyle = CommonHelper.readQSS(styleFile)
    win.setStyleSheet(qssStyle)
    win.show()
    sys.exit(app.exec_())
コード例 #16
0
 def style_ConsoleStyle(self):
     styleFile = './QSS-master/ConsoleStyle.qss'
     self.qssStyle = CommonHelper.readQSS(styleFile)
     self.qssStyleDia = CommonHelper.readQSS(styleFile)
     QMainWindow.setStyleSheet(self, self.qssStyle)
コード例 #17
0
        if (userId != '' and userPsw != ''):
            #self.hintLabel.setText("loading...")
            if (dbController.CheckLogin(userId, userPsw)):
                # if condition: userid not in teacher, emit 1
                if dbController.CheckAdmin(userId):
                    self.login_Signal.emit(1)
                else:
                    moduleName = self.checkModule(userId)
                    self.login_Signal.emit(0)
        self.hintLabel.setText("Invalid username or password!")

    def forgetPwd(self):
        #self.forgetPwd_Signal.emit()
        #print("forget")
        self.hintLabel.setText("Please contact the admin! 188-8888-8888")

    def checkModule(self, userId):
        #print(userId)
        d = dbController.GetTeacherInfo(userId)
        #print(d)
        return d


# test code for the single view
if __name__ == "__main__":
    app = QApplication(sys.argv)
    mainWindow = login_View()
    mainWindow.show()
    CommonHelper.readQSS("resources/qss/login.qss", app)
    sys.exit(app.exec_())