tirilane
/
egon
Archived
1
0
Fork 0

Bug with scheduleheaders fixed.

This commit is contained in:
Tiril Anette Langfeldt Rødland 2008-08-04 11:10:17 +00:00
parent 5ab4f2514e
commit 879eebef70
1 changed files with 13 additions and 7 deletions

20
egon.py
View File

@ -18,7 +18,7 @@ from pysqlite2 import dbapi2 as sqlite
from qrc_resources import * from qrc_resources import *
__version__ = "1.0.1" __version__ = "1.0.2"
main = None main = None
@ -1065,8 +1065,16 @@ class ScheduleTab(QWidget):
## Make an empty schedule table ## Make an empty schedule table
def makeTable(self, current=None): def makeTable(self, current=None):
self.scheduleTable = QTableWidget(12, 5, self) self.scheduleTable = QTableWidget(12, 5, self)
self.scheduleTable.setRowCount(11) self.scheduleTable.setRowCount(12)
self.scheduleTable.clear() 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 = QStringList()
self.scheduleHorizontalHeaderList.append(self.trUtf8("Monday")) self.scheduleHorizontalHeaderList.append(self.trUtf8("Monday"))
self.scheduleHorizontalHeaderList.append(self.trUtf8("Tuesday")) self.scheduleHorizontalHeaderList.append(self.trUtf8("Tuesday"))
@ -1078,20 +1086,18 @@ class ScheduleTab(QWidget):
self.scheduleVerticalHeaderList.append(self.trUtf8("%i" % i)) self.scheduleVerticalHeaderList.append(self.trUtf8("%i" % i))
self.scheduleTable.setHorizontalHeaderLabels(self.scheduleHorizontalHeaderList) self.scheduleTable.setHorizontalHeaderLabels(self.scheduleHorizontalHeaderList)
self.scheduleTable.setVerticalHeaderLabels(self.scheduleVerticalHeaderList) 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 ## Add the lessons of the semester to the table
def updateTable(self, semester): def updateTable(self, semester):
self.schedule = getLessonsFromDB(semester) self.schedule = getLessonsFromDB(semester)
rows = len(self.schedule) rows = len(self.schedule)
self.scheduleTable.clear()
for l in range(rows): for l in range(rows):
self.addLessonToTable(self.schedule[l]) self.addLessonToTable(self.schedule[l])
self.scheduleTable.horizontalHeader().setResizeMode(QHeaderView.ResizeToContents) self.scheduleTable.horizontalHeader().setResizeMode(QHeaderView.ResizeToContents)
self.scheduleTable.verticalHeader().setResizeMode(QHeaderView.ResizeToContents) self.scheduleTable.verticalHeader().setResizeMode(QHeaderView.ResizeToContents)
self.updateHeaders()
## Add a new lesson to the table ## Add a new lesson to the table
def addLessonToTable(self, lesson): def addLessonToTable(self, lesson):