From 879eebef70df609a8061652e53561a4429b7e241 Mon Sep 17 00:00:00 2001 From: tirilane Date: Mon, 4 Aug 2008 11:10:17 +0000 Subject: [PATCH] Bug with scheduleheaders fixed. --- egon.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/egon.py b/egon.py index f379291..2603d5d 100755 --- a/egon.py +++ b/egon.py @@ -18,7 +18,7 @@ from pysqlite2 import dbapi2 as sqlite from qrc_resources import * -__version__ = "1.0.1" +__version__ = "1.0.2" main = None @@ -1065,8 +1065,16 @@ class ScheduleTab(QWidget): ## Make an empty schedule table def makeTable(self, current=None): self.scheduleTable = QTableWidget(12, 5, self) - self.scheduleTable.setRowCount(11) + self.scheduleTable.setRowCount(12) self.scheduleTable.clear() + self.updateHeaders() + self.scheduleTable.setAlternatingRowColors(False) + self.scheduleTable.setEditTriggers(QAbstractItemView.NoEditTriggers) + self.scheduleTable.setSelectionBehavior(QAbstractItemView.SelectItems) + self.scheduleTable.setSelectionMode(QAbstractItemView.SingleSelection) + selected = None + + def updateHeaders(self): self.scheduleHorizontalHeaderList = QStringList() self.scheduleHorizontalHeaderList.append(self.trUtf8("Monday")) self.scheduleHorizontalHeaderList.append(self.trUtf8("Tuesday")) @@ -1078,20 +1086,18 @@ class ScheduleTab(QWidget): self.scheduleVerticalHeaderList.append(self.trUtf8("%i" % i)) self.scheduleTable.setHorizontalHeaderLabels(self.scheduleHorizontalHeaderList) self.scheduleTable.setVerticalHeaderLabels(self.scheduleVerticalHeaderList) - self.scheduleTable.setAlternatingRowColors(False) - self.scheduleTable.setEditTriggers(QAbstractItemView.NoEditTriggers) - self.scheduleTable.setSelectionBehavior(QAbstractItemView.SelectItems) - self.scheduleTable.setSelectionMode(QAbstractItemView.SingleSelection) - selected = None + ## Add the lessons of the semester to the table def updateTable(self, semester): self.schedule = getLessonsFromDB(semester) rows = len(self.schedule) + self.scheduleTable.clear() for l in range(rows): self.addLessonToTable(self.schedule[l]) self.scheduleTable.horizontalHeader().setResizeMode(QHeaderView.ResizeToContents) self.scheduleTable.verticalHeader().setResizeMode(QHeaderView.ResizeToContents) + self.updateHeaders() ## Add a new lesson to the table def addLessonToTable(self, lesson):