Пример #1
0
    def settimetable(self):

        cur.execute("select max(day) from timetable")
        a = cur.fetchone()

        if a[0] == None:
            cur.execute("select * from days")
            b = cur.fetchone()

            if b == None:
                self.showmessage('Set timeslots and Days first')
                self.ttdetails = Startttdetailsex()
                self.ttdetails.show()
                QtCore.QObject.connect(self.ttdetails.done,
                                       QtCore.SIGNAL("clicked()"),
                                       self.settimetable)
                QtCore.QObject.connect(self.ttdetails.cancel,
                                       QtCore.SIGNAL("clicked()"),
                                       self.settimetable)

            else:
                cur.execute("select * from acads")
                a = cur.fetchone()
                if a == None:
                    self.showmessage('Add a subject first')

                else:
                    self.showmessage('Set the periods and save')
                    self.ttedit = Starttimetableedit()
                    self.ttedit.show()

                    QtCore.QObject.connect(self.ttedit.save,
                                           QtCore.SIGNAL("clicked()"),
                                           self.settimetable)

        else:

            self.timetable = Starttimetable()

            self.ui.maintabWidget.insertTab(3, self.timetable, 'Timetable')
            self.ttflag = 1
            cur.execute("insert into timetableflag values(1)")
            con.commit()
Пример #2
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_window()
        self.ui.setupUi(self)
        

        
        self.setedit = Starttimetableedit()
        self.ttdetails = Startttdetailsex()
        
        self.ui.sem.setVisible(False)
        self.setsem()
        self.setcolrow()
        self.settimetable()
        
        
        
        QtCore.QObject.connect(self.setedit.ttdetails.done, QtCore.SIGNAL("clicked()"), self.close)
        QtCore.QObject.connect(self.ui.sem, QtCore.SIGNAL("currentIndexChanged(int)"), self.settimetable)
        QtCore.QObject.connect(self.ui.edit, QtCore.SIGNAL("clicked()"), self.setedited)

        self.ui.edit.setStyleSheet('background-color: rgb(0, 147, 203); color: rgb(255, 255, 255);')        
Пример #3
0
    def __init__(self, parent=None, flags=1):
        QtGui.QWidget.__init__(self, parent)

        self.ttdetails = Startttdetailsex()

        icon = QtGui.QIcon()
        b = QtGui.QPixmap("./pics/logo.png")
        icon.addPixmap(b)
        self.setWindowIcon(icon)
        cur.execute("select * from days")
        a = cur.fetchone()

        palette2 = QtGui.QPalette()
        palette2.setBrush(self.backgroundRole(),
                          QBrush(QImage("./pics/genback.png")))

        self.setPalette(palette2)

        self.setStyleSheet('color: rgb(85, 0, 0);')

        self.period = []
        self.timeslotslabel = []
        self.dayslabel = [
            QtGui.QLabel('     '),
            QtGui.QLabel('Monday'),
            QtGui.QLabel('Tuesday'),
            QtGui.QLabel('Wednesday'),
            QtGui.QLabel('Thursday'),
            QtGui.QLabel('Friday'),
            QtGui.QLabel('Saturday'),
            QtGui.QLabel('Sunday'),
        ]

        self.semcombobox = QtGui.QComboBox()

        self.setsem()
        mainvbox = QtGui.QVBoxLayout()
        self.mainhbox = QtGui.QHBoxLayout()
        self.setWindowTitle('Edit timetable')
        self.dayslabelbox = QtGui.QVBoxLayout()

        self.loop4()

        self.mainhbox.addLayout(self.dayslabelbox)

        sembox = QtGui.QHBoxLayout()
        self.timebox = []

        self.semlabel = QtGui.QLabel("Semester   :")
        self.semlabel.setVisible(False)

        self.semcombobox.setFixedSize(40, 30)
        self.semcombobox.setVisible(False)
        self.genlabel1 = QtGui.QLabel(
            " You must click save after making the changes")

        self.save = QtGui.QToolButton()
        self.save.setText('Save')

        self.editslot = QtGui.QToolButton()
        self.editslot.setText('Edit slots and days')

        sembox.addWidget(self.semlabel)
        sembox.addWidget(self.semcombobox)
        sembox.addWidget(self.genlabel1)
        sembox.addWidget(self.editslot)
        sembox.addWidget(self.save)

        self.loop3()

        self.loop1()

        self.settimetable()

        mainvbox.addLayout(sembox)

        mainvbox.addLayout(self.mainhbox)

        self.setLayout(mainvbox)

        QtCore.QObject.connect(self.semcombobox,
                               QtCore.SIGNAL("currentIndexChanged(int)"),
                               self.loop2)
        QtCore.QObject.connect(self.save, QtCore.SIGNAL("clicked()"),
                               self.saved)
        QtCore.QObject.connect(self.editslot, QtCore.SIGNAL("clicked()"),
                               self.editsloted)

        self.save.setStyleSheet(
            'background-color: rgb(0, 147, 203); color: rgb(255, 255, 255);')
        self.editslot.setStyleSheet(
            'background-color: rgb(0, 147, 203); color: rgb(255, 255, 255);')