Bug with scheduleheaders fixed.
This commit is contained in:
parent
5ab4f2514e
commit
879eebef70
20
egon.py
20
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):
|
||||
|
|
Reference in New Issue