[956] | 1 |
|
---|
| 2 | import sys
|
---|
| 3 | from PyQt4.QtCore import *
|
---|
| 4 | from PyQt4.QtGui import *
|
---|
| 5 | from PyQt4 import QtCore, QtGui
|
---|
| 6 | import Ui_schedule
|
---|
| 7 |
|
---|
| 8 | import calendar
|
---|
| 9 | calendar.setfirstweekday(calendar.SUNDAY)
|
---|
| 10 |
|
---|
| 11 | #from nosferatu import configrules,directive,scheduleparser
|
---|
| 12 | #from nosferatu import configrules,directive,scheduleparser
|
---|
| 13 | from nosferatu import scheduleparser, auto_types, prettynames
|
---|
| 14 | #import scheduleparser # TODO: rename this file
|
---|
| 15 |
|
---|
| 16 | #import directive
|
---|
| 17 |
|
---|
| 18 |
|
---|
| 19 | weekdays = ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat')
|
---|
| 20 | ordinals = ('1st', '2nd', '3rd', '4th', '5th')
|
---|
| 21 | months = ('Jan','Feb', 'Mar', 'Apr', 'May', 'Jun',
|
---|
| 22 | 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec')
|
---|
| 23 |
|
---|
| 24 | periods = ['monthly', 'weekly', 'daily', 'hourly']
|
---|
| 25 | periods.reverse()
|
---|
| 26 | # lists of checkboxes
|
---|
| 27 | woyList = []
|
---|
| 28 | womList = []
|
---|
| 29 | monthdayList = []
|
---|
| 30 | weekdayList = []
|
---|
| 31 | monthList = []
|
---|
| 32 | periodList = []
|
---|
| 33 |
|
---|
| 34 | #TODO: put all definitions this in a central file
|
---|
| 35 | INTERNALLY_REFERENCED_ITEMS = set(['fileset',
|
---|
| 36 | 'client' ,
|
---|
| 37 | 'catalog',
|
---|
| 38 | 'messages',
|
---|
| 39 | 'schedule',
|
---|
| 40 | 'storage',
|
---|
| 41 | 'jobdefs',
|
---|
| 42 | 'pool',
|
---|
| 43 | 'incrementalbackuppool',
|
---|
| 44 | 'fullbackuppool',
|
---|
| 45 | 'differentialbackuppool',
|
---|
| 46 | 'job',
|
---|
| 47 | 'basejob',
|
---|
| 48 | 'device',
|
---|
| 49 | ])
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 | class indexCheckBox(QCheckBox):
|
---|
| 53 | def __init__(self, parent, index):
|
---|
| 54 | super(indexCheckBox, self).__init__(parent)
|
---|
| 55 | self.index = index
|
---|
| 56 |
|
---|
| 57 |
|
---|
| 58 |
|
---|
| 59 | class RunentryDialog(QDialog, Ui_schedule.Ui_Dialog):
|
---|
| 60 | def __init__(self, parent=None, runentry=None, parentconfig=None):
|
---|
| 61 | super(RunentryDialog, self).__init__(parent)
|
---|
| 62 | self.setupUi(self)
|
---|
| 63 | self.parentconfig = parentconfig
|
---|
| 64 | self.runentry = runentry
|
---|
| 65 |
|
---|
| 66 | self.connect(self.buttonBox, SIGNAL("accepted()"),
|
---|
| 67 | self, SLOT("accept()"))
|
---|
| 68 | self.connect(self.buttonBox, SIGNAL("rejected()"),
|
---|
| 69 | self, SLOT("reject()"))
|
---|
| 70 | self.setWindowTitle("Edit Schedule Run Entry")
|
---|
| 71 |
|
---|
| 72 |
|
---|
| 73 |
|
---|
| 74 |
|
---|
| 75 | # enable / disable groupboxes depending on status of runentry
|
---|
| 76 | if len(self.runentry.sched['woy']) == 0:
|
---|
| 77 | self.weekOfYearGroupBox.setChecked(False)
|
---|
| 78 | else:
|
---|
| 79 | self.weekOfYearGroupBox.setChecked(True)
|
---|
| 80 |
|
---|
| 81 | if len(self.runentry.sched['mday']) == 0:
|
---|
| 82 | self.monthDayGroupBox.setChecked(False)
|
---|
| 83 | else:
|
---|
| 84 | self.monthDayGroupBox.setChecked(True)
|
---|
| 85 |
|
---|
| 86 | if len(self.runentry.sched['month']) == 0:
|
---|
| 87 | self.monthGroupBox.setChecked(False)
|
---|
| 88 | else:
|
---|
| 89 | self.monthGroupBox.setChecked(True)
|
---|
| 90 |
|
---|
| 91 | self.periodGroupBox.setChecked(False)
|
---|
| 92 | for period in periods:
|
---|
| 93 | if self.runentry.sched[period]:
|
---|
| 94 | self.periodGroupBox.setChecked(True)
|
---|
| 95 |
|
---|
| 96 | self.overridesBox.setChecked(False)
|
---|
| 97 | for override in scheduleparser.overrides:
|
---|
| 98 | if self.runentry.overrides[override] is not None:
|
---|
| 99 | self.overridesBox.setChecked(True)
|
---|
| 100 |
|
---|
| 101 | # fill the weeks of the year
|
---|
| 102 | for i in range(1,54):
|
---|
| 103 | #self.checkBox = QtGui.QCheckBox(self.weekOfYearGroupBox)
|
---|
| 104 | self.checkBox = indexCheckBox(self.weekOfYearGroupBox,i)
|
---|
| 105 | self.checkBox.setObjectName(str(i))
|
---|
| 106 | self.checkBox.setObjectName('weekOfYear' + str(i))
|
---|
| 107 | self.checkBox.setText(str(i))
|
---|
| 108 | # set the checkbox according to the runentry's status
|
---|
| 109 | if i in self.runentry.sched['woy']:
|
---|
| 110 | self.checkBox.setChecked(True)
|
---|
| 111 | else:
|
---|
| 112 | self.checkBox.setChecked(False)
|
---|
| 113 |
|
---|
| 114 | self.gridLayout_6.addWidget(self.checkBox, i/10, i%10, 1, 1)
|
---|
| 115 | self.connect(self.checkBox ,SIGNAL("stateChanged(int)"), self.updateYearWeek)
|
---|
| 116 |
|
---|
| 117 | woyList.append(self.checkBox)
|
---|
| 118 |
|
---|
| 119 | # fill monthday
|
---|
| 120 | for i in range(1,32):
|
---|
| 121 | self.checkBox = indexCheckBox(self.monthDayGroupBox, i)
|
---|
| 122 | self.checkBox.setObjectName('monthDay' + str(i))
|
---|
| 123 | self.checkBox.setText(str(i))
|
---|
| 124 | # set checkbox
|
---|
| 125 | if i in self.runentry.sched['mday']:
|
---|
| 126 | self.checkBox.setChecked(True)
|
---|
| 127 | else:
|
---|
| 128 | self.checkBox.setChecked(False)
|
---|
| 129 |
|
---|
| 130 | self.gridLayout_4.addWidget(self.checkBox, i/7, i%7, 1, 1)
|
---|
| 131 | self.connect(self.checkBox , SIGNAL("stateChanged(int)"), self.updateMonthDay)
|
---|
| 132 | monthdayList.append(self.checkBox)
|
---|
| 133 |
|
---|
| 134 | for day in range(7):
|
---|
| 135 | #print calendar.day_name[day]
|
---|
| 136 | #print weekdays[day]
|
---|
| 137 | self.checkBox = indexCheckBox(self.weekDayGroupBox, day)
|
---|
| 138 | self.checkBox.setObjectName(weekdays[day])
|
---|
| 139 | self.checkBox.setText(weekdays[day])
|
---|
| 140 | # set checkbox
|
---|
| 141 | if day in self.runentry.sched['wday']:
|
---|
| 142 | self.checkBox.setChecked(True)
|
---|
| 143 | else:
|
---|
| 144 | self.checkBox.setChecked(False)
|
---|
| 145 | self.gridLayout_8.addWidget(self.checkBox, day/5, day%5, 1, 1)
|
---|
| 146 | self.connect(self.checkBox , SIGNAL("stateChanged(int)"), self.updateWeekDay)
|
---|
| 147 | weekdayList.append(self.checkBox)
|
---|
| 148 |
|
---|
| 149 |
|
---|
| 150 | for month in range(1,13):
|
---|
| 151 | #print calendar.month_name[month]
|
---|
| 152 | self.checkBox = indexCheckBox(self.monthGroupBox, month)
|
---|
| 153 | self.checkBox.setObjectName(calendar.month_name[month])
|
---|
| 154 | self.checkBox.setText(QString(calendar.month_name[month]))
|
---|
| 155 | # set checkbox
|
---|
| 156 | if month-1 in self.runentry.sched['month']:
|
---|
| 157 | self.checkBox.setChecked(True)
|
---|
| 158 | else:
|
---|
| 159 | self.checkBox.setChecked(False)
|
---|
| 160 |
|
---|
| 161 | self.gridLayout_3.addWidget(self.checkBox, (month-1)/3, (month-1)%3, 1, 1)
|
---|
| 162 | self.connect(self.checkBox , SIGNAL("stateChanged(int)"), self.updateMonth)
|
---|
| 163 | monthList.append(self.checkBox)
|
---|
| 164 |
|
---|
| 165 | for week in range(5):
|
---|
| 166 | #print ordinals[week]
|
---|
| 167 | self.checkBox = indexCheckBox(self.weekOfMonthGroupBox, week)
|
---|
| 168 | self.checkBox.setObjectName(ordinals[week])
|
---|
| 169 | self.checkBox.setText(ordinals[week])
|
---|
| 170 | # set checkbox
|
---|
| 171 | if week in self.runentry.sched['wom']:
|
---|
| 172 | self.checkBox.setChecked(True)
|
---|
| 173 | else:
|
---|
| 174 | self.checkBox.setChecked(False)
|
---|
| 175 | #self.gridLayout_5.addWidget(self.checkBox)
|
---|
| 176 | self.gridLayout_5.addWidget(self.checkBox, 0, week, 1, 1)
|
---|
| 177 | self.connect(self.checkBox , SIGNAL("stateChanged(int)"), self.updateWeekOfMonth)
|
---|
| 178 | womList.append(self.checkBox)
|
---|
| 179 |
|
---|
| 180 |
|
---|
| 181 | for period in periods:
|
---|
| 182 | self.checkBox = indexCheckBox(self.periodGroupBox, period)
|
---|
| 183 | self.checkBox.setObjectName(period)
|
---|
| 184 | self.checkBox.setText(period)
|
---|
| 185 | if self.runentry.sched[period]:
|
---|
| 186 | self.checkBox.setChecked(True)
|
---|
| 187 | else:
|
---|
| 188 | self.checkBox.setChecked(False)
|
---|
| 189 | #self.gridLayout_5.addWidget(self.checkBox)
|
---|
| 190 | self.verticalLayout.addWidget(self.checkBox)
|
---|
| 191 | self.connect(self.checkBox , SIGNAL("stateChanged(int)"), self.updatePeriod)
|
---|
| 192 | periodList.append(self.checkBox)
|
---|
| 193 |
|
---|
| 194 |
|
---|
| 195 | i = 0
|
---|
| 196 | for override in scheduleparser.overrides:
|
---|
| 197 | # label
|
---|
| 198 | self.label = QtGui.QLabel(self.overridesBox)
|
---|
| 199 | self.label.setObjectName(override+'label')
|
---|
| 200 | self.label.setText(override)
|
---|
| 201 | #self.label.setText(directive.PrettyNames[override])
|
---|
| 202 | self.gridLayout_7.addWidget(self.label, 2*i/4, 2*i%4, 1, 1)
|
---|
| 203 |
|
---|
| 204 |
|
---|
| 205 | if override == 'priority':
|
---|
| 206 | SpinBox = QtGui.QSpinBox()
|
---|
| 207 | SpinBox.setObjectName(override)
|
---|
| 208 | SpinBox.setMinimum(1)
|
---|
| 209 | SpinBox.setMaximum(99)
|
---|
| 210 | SpinBox.setValue(10)
|
---|
| 211 | self.connect( SpinBox,
|
---|
| 212 | SIGNAL("valueChanged(int)"),
|
---|
| 213 | self.onSpinboxChanged )
|
---|
| 214 | self.gridLayout_7.addWidget(SpinBox, 2*i/4 , (2*i%4) + 1, 1, 1)
|
---|
| 215 |
|
---|
| 216 | elif override not in scheduleparser.bool_overrides:
|
---|
| 217 | # combobox/checkbox
|
---|
| 218 | self.ComboBox = QtGui.QComboBox(self.overridesBox)
|
---|
| 219 | self.ComboBox.setObjectName(override)
|
---|
| 220 | self.ComboBox.addItem('') # empty
|
---|
| 221 | self.ComboBox.setEditable(True)
|
---|
| 222 | # if parentconfig is available, fill overrides with possible values
|
---|
| 223 | if self.parentconfig is not None:
|
---|
| 224 | if override.endswith('pool'):
|
---|
| 225 | override = 'pool'
|
---|
| 226 | if override.endswith('job'):
|
---|
| 227 | override = 'job'
|
---|
| 228 |
|
---|
| 229 | for r in self.parentconfig.getResourcesListByResType(override):
|
---|
| 230 | self.ComboBox.addItem(r.items_dict['name'].storage.value)
|
---|
| 231 | self.ComboBox.setEditable(False) # remove editable if we have info
|
---|
| 232 |
|
---|
| 233 |
|
---|
| 234 | if self.ComboBox.isEditable():
|
---|
| 235 | if self.runentry.overrides[override] is not None:
|
---|
| 236 | self.ComboBox.addItem(self.runentry.overrides[override])
|
---|
| 237 | self.connect( self.ComboBox.lineEdit(),
|
---|
| 238 | SIGNAL("editingFinished()"),
|
---|
| 239 | self.onLineeditChanged )
|
---|
| 240 | if override == 'level':
|
---|
| 241 | self.ComboBox.setEditable(False)
|
---|
| 242 | for lvl in auto_types.joblevels:
|
---|
| 243 | self.ComboBox.addItem(prettynames.prettyName(lvl))
|
---|
| 244 |
|
---|
| 245 |
|
---|
| 246 |
|
---|
| 247 |
|
---|
| 248 |
|
---|
| 249 | #self.ComboBox.addItem(override)
|
---|
| 250 |
|
---|
| 251 |
|
---|
| 252 |
|
---|
| 253 |
|
---|
| 254 | self.connect( self.ComboBox,
|
---|
| 255 | SIGNAL("currentIndexChanged(int)"),
|
---|
| 256 | self.onComboboxChanged )
|
---|
| 257 |
|
---|
| 258 | #self.connect( self.ComboBox,
|
---|
| 259 | # SIGNAL("editingFinished(int)"),
|
---|
| 260 | # self.onComboboxChanged )
|
---|
| 261 | self.gridLayout_7.addWidget(self.ComboBox, 2*i/4 , (2*i%4) + 1, 1, 1)
|
---|
| 262 |
|
---|
| 263 | else:
|
---|
| 264 | self.ComboBox = QtGui.QComboBox(self.overridesBox)
|
---|
| 265 | self.ComboBox.setObjectName(override)
|
---|
| 266 | self.ComboBox.addItem('') # empty
|
---|
| 267 | self.ComboBox.addItem('Yes') # empty
|
---|
| 268 | self.ComboBox.addItem('No') # empty
|
---|
| 269 | #self.ComboBox.setEditable(True)
|
---|
| 270 | self.gridLayout_7.addWidget(self.ComboBox, 2*i/4, (2*i%4)+1, 1, 1)
|
---|
| 271 | self.connect( self.ComboBox,
|
---|
| 272 | SIGNAL("currentIndexChanged(int)"),
|
---|
| 273 | self.onComboboxChanged )
|
---|
| 274 |
|
---|
| 275 | #self.checkBox = QtGui.QCheckBox(self.overridesBox)
|
---|
| 276 | ##self.checkBox.setTristate(True)
|
---|
| 277 | #self.checkBox.setObjectName(override)
|
---|
| 278 | #self.connect(self.checkBox , SIGNAL("stateChanged(int)"), self.onOverridesCheckbox)
|
---|
| 279 | #self.gridLayout_7.addWidget(self.checkBox, 2*i/4 , (2*i%4)+1, 1, 1)
|
---|
| 280 | i += 1
|
---|
| 281 |
|
---|
| 282 | self.updateOverrides() # set the overrides according to the values
|
---|
| 283 | # connect signals
|
---|
| 284 | #QTimeEdit.tim
|
---|
| 285 | tmptime=QTime()
|
---|
| 286 | tmptime.setHMS(self.runentry.hour, self.runentry.minute, 0)
|
---|
| 287 | self.timeEdit.setTime(tmptime)
|
---|
| 288 | self.connect(self.timeEdit , SIGNAL("timeChanged(QTime)"), self.updateTime)
|
---|
| 289 | #self.connect(self.actionNew_director, SIGNAL("triggered()"), self.newDirector
|
---|
| 290 | self.createOutput()
|
---|
| 291 |
|
---|
| 292 | def updatePreviewTable(self):
|
---|
| 293 | self.previewTableWidget.setColumnCount(6)
|
---|
| 294 |
|
---|
| 295 | self.previewTableWidget.setHorizontalHeaderLabels(['WD','D','M','Y','Time','Overrides'])
|
---|
| 296 | row = 0
|
---|
| 297 | self.previewTableWidget.setRowCount(len(self.runentry.runTimes))
|
---|
| 298 | self.previewTableWidget.setAlternatingRowColors(True)
|
---|
| 299 | for dt in self.runentry.runTimes:
|
---|
| 300 | #bgcolor = QColor("white")
|
---|
| 301 |
|
---|
| 302 | wday = scheduleparser.weekdays[(dt.weekday()+1)%7]
|
---|
| 303 |
|
---|
| 304 | item = QtGui.QTableWidgetItem(wday)
|
---|
| 305 | #item.setBackgroundColor(bgcolor)
|
---|
| 306 | self.previewTableWidget.setItem(row, 0, item)
|
---|
| 307 |
|
---|
| 308 |
|
---|
| 309 | item = QtGui.QTableWidgetItem(str(dt.day))
|
---|
| 310 | #item.setBackgroundColor(bgcolor)
|
---|
| 311 | self.previewTableWidget.setItem(row, 1, item)
|
---|
| 312 |
|
---|
| 313 | item = QtGui.QTableWidgetItem(scheduleparser.months[dt.month-1])
|
---|
| 314 | #item.setBackgroundColor(bgcolor)
|
---|
| 315 | self.previewTableWidget.setItem(row, 2, item)
|
---|
| 316 |
|
---|
| 317 | #if dt.month %2:
|
---|
| 318 | # bgcolor = QColor("light gray")
|
---|
| 319 | #else:
|
---|
| 320 | # bgcolor = QColor("white")
|
---|
| 321 | item = QtGui.QTableWidgetItem(str(dt.year))
|
---|
| 322 | #item.setBackgroundColor(bgcolor)
|
---|
| 323 | self.previewTableWidget.setItem(row, 3, item)
|
---|
| 324 |
|
---|
| 325 | item = QtGui.QTableWidgetItem("%02d:%02d" % (dt.hour,dt.minute))
|
---|
| 326 | #item.setBackgroundColor(bgcolor)
|
---|
| 327 | self.previewTableWidget.setItem(row, 4, item)
|
---|
| 328 |
|
---|
| 329 | # overrides
|
---|
| 330 | s = ''
|
---|
| 331 | for ov,val in self.runentry.overrides.iteritems():
|
---|
| 332 | if val != None:
|
---|
| 333 | s += "%s=%s " %(ov,val)
|
---|
| 334 | if s == '':
|
---|
| 335 | s = '[None]'
|
---|
| 336 | item = QtGui.QTableWidgetItem(s)
|
---|
| 337 | #item.setBackgroundColor(bgcolor)
|
---|
| 338 | self.previewTableWidget.setItem(row, 5, item)
|
---|
| 339 |
|
---|
| 340 | row += 1
|
---|
| 341 |
|
---|
| 342 | self.previewTableWidget.resizeRowsToContents()
|
---|
| 343 | self.previewTableWidget.resizeColumnsToContents()
|
---|
| 344 |
|
---|
| 345 | def updateOverrides(self):
|
---|
| 346 | '''update the overrides comboboxes and checkboxes
|
---|
| 347 | from runentry data
|
---|
| 348 | '''
|
---|
| 349 | for child in self.overridesBox.children():
|
---|
| 350 | if type(child).__name__ == 'QComboBox':
|
---|
| 351 | override = str(child.objectName())
|
---|
| 352 | print override
|
---|
| 353 | overrideval = self.runentry.overrides[override]
|
---|
| 354 | if overrideval is not None:
|
---|
| 355 | idx = child.findText(overrideval)
|
---|
| 356 | if idx != -1:
|
---|
| 357 | child.setCurrentIndex(idx)
|
---|
| 358 |
|
---|
| 359 | elif type(child).__name__ == 'QCheckBox':
|
---|
| 360 | override = str(child.objectName())
|
---|
| 361 | print override
|
---|
| 362 | overrideval = self.runentry.overrides[override]
|
---|
| 363 | if overrideval is not None:
|
---|
| 364 | if overrideval.lower() == "yes":
|
---|
| 365 | child.setChecked(True)
|
---|
| 366 | else:
|
---|
| 367 | child.setChecked(False)
|
---|
| 368 |
|
---|
| 369 | elif type(child).__name__ == 'QSpinBox':
|
---|
| 370 | override = str(child.objectName())
|
---|
| 371 | overrideval = self.runentry.overrides[override]
|
---|
| 372 | if overrideval is None:
|
---|
| 373 | child.setValue(10)
|
---|
| 374 | else:
|
---|
| 375 | child.setValue(int(overrideval))
|
---|
| 376 |
|
---|
| 377 |
|
---|
| 378 | def onSpinboxChanged(self):
|
---|
| 379 | print "spinbox was changed by:" , self.sender().objectName() , "to:" , str(self.sender().value()).lower().replace(' ','')
|
---|
| 380 | if self.sender().value() == 10:
|
---|
| 381 | self.runentry.overrides[str(self.sender().objectName())] = None # do not write Priority if default value is given
|
---|
| 382 | else:
|
---|
| 383 | self.runentry.overrides[str(self.sender().objectName())] = self.sender().value()
|
---|
| 384 | self.createOutput()
|
---|
| 385 |
|
---|
| 386 | def onComboboxChanged(self):
|
---|
| 387 | if self.sender().currentText() == '': # delete this override
|
---|
| 388 | self.runentry.overrides[str(self.sender().objectName())] = None
|
---|
| 389 | else:
|
---|
| 390 | self.runentry.overrides[str(self.sender().objectName())] = str(self.sender().currentText())
|
---|
| 391 | print "combobox was changed by:" , self.sender().objectName() , "to:" , str(self.sender().currentText()).lower().replace(' ','')
|
---|
| 392 | self.createOutput()
|
---|
| 393 |
|
---|
| 394 | def onOverridesCheckbox(self):
|
---|
| 395 | print "onOverridesCheckbox called"
|
---|
| 396 | print self.sender().objectName()
|
---|
| 397 | if self.sender().isChecked():
|
---|
| 398 | self.runentry.overrides[self.sender().objectName()] ="yes"
|
---|
| 399 | else:
|
---|
| 400 | self.runentry.overrides[self.sender().objectName()] ="no"
|
---|
| 401 | self.createOutput()
|
---|
| 402 |
|
---|
| 403 |
|
---|
| 404 | def onLineeditChanged(self):
|
---|
| 405 | print "Lineedit was changed by:" , self.sender().objectName() , "to:" , self.sender().text()
|
---|
| 406 |
|
---|
| 407 | def updatePeriod(self):
|
---|
| 408 | if self.sender().isChecked():
|
---|
| 409 | print self.sender().text()
|
---|
| 410 | self.runentry.sched[str(self.sender().text())].add(self.sender().text())
|
---|
| 411 | else:
|
---|
| 412 | self.runentry.sched[str(self.sender().text())].clear()
|
---|
| 413 | self.createOutput()
|
---|
| 414 |
|
---|
| 415 |
|
---|
| 416 | def updateTime(self):
|
---|
| 417 | print "updateResult"
|
---|
| 418 | global timeOutput
|
---|
| 419 | # get time from time Widget
|
---|
| 420 | self.runentry.hour = self.timeEdit.time().hour()
|
---|
| 421 | self.runentry.minute = self.timeEdit.time().minute()
|
---|
| 422 | self.createOutput()
|
---|
| 423 |
|
---|
| 424 | def updateWeekDay(self):
|
---|
| 425 | if self.sender().isChecked():
|
---|
| 426 | self.runentry.sched['wday'].add(self.sender().index)
|
---|
| 427 | else:
|
---|
| 428 | self.runentry.sched['wday'].remove(self.sender().index)
|
---|
| 429 | self.createOutput()
|
---|
| 430 |
|
---|
| 431 | def updateYearWeek(self):
|
---|
| 432 | if self.sender().isChecked():
|
---|
| 433 | self.runentry.sched['woy'].add(self.sender().index)
|
---|
| 434 | else:
|
---|
| 435 | self.runentry.sched['woy'].remove(self.sender().index)
|
---|
| 436 | self.createOutput()
|
---|
| 437 |
|
---|
| 438 | def updateMonth(self):
|
---|
| 439 | if self.sender().isChecked():
|
---|
| 440 | self.runentry.sched['month'].add(self.sender().index-1)
|
---|
| 441 | else:
|
---|
| 442 | self.runentry.sched['month'].remove(self.sender().index-1)
|
---|
| 443 | self.createOutput()
|
---|
| 444 |
|
---|
| 445 | def updateMonthDay(self):
|
---|
| 446 | if self.sender().isChecked():
|
---|
| 447 | self.runentry.sched['mday'].add(self.sender().index)
|
---|
| 448 | else:
|
---|
| 449 | self.runentry.sched['mday'].remove(self.sender().index)
|
---|
| 450 | self.createOutput()
|
---|
| 451 |
|
---|
| 452 | def updateWeekOfMonth(self):
|
---|
| 453 | if self.sender().isChecked():
|
---|
| 454 | self.runentry.sched['wom'].add(self.sender().index)
|
---|
| 455 | else:
|
---|
| 456 | self.runentry.sched['wom'].remove(self.sender().index)
|
---|
| 457 | self.createOutput()
|
---|
| 458 |
|
---|
| 459 |
|
---|
| 460 | def createOutput(self):
|
---|
| 461 | self.resultLineEdit.setText(str(self.runentry))
|
---|
| 462 | self.runentry.calcStarttimes()
|
---|
| 463 | self.updatePreviewTable()
|
---|
| 464 | print self.runentry.overrides
|
---|
| 465 |
|
---|
| 466 | if __name__ == "__main__":
|
---|
| 467 | import sys
|
---|
| 468 | from nosferatu import scheduleparser
|
---|
| 469 | app = QApplication(sys.argv)
|
---|
| 470 | #s = 'level=Full on Jul,Aug,Oct,sep 1,2,3,4,10,16 first,2nd,3rd,fifth Tue,Wed w23,w26,w28,w37 monthly weekly at 12:32'
|
---|
| 471 |
|
---|
| 472 | #s = 'Level=Full Storage=Blafasel 1st Mon Jan at 23:05'
|
---|
| 473 | s = 'level=Full pool="wilmak17-geradePool" on mon-fri w00,w02,w04,w06,w08,w10,w12,w14,w16,w18,w20,w22,w24,w26,w28,w30,w32,w34,w36,w38,w40,w42,w44,w46,w48,w50,w52 at 23:00'
|
---|
| 474 | runentry = scheduleparser.RunEntry(s)
|
---|
| 475 | dialog = RunentryDialog(None,runentry)
|
---|
| 476 |
|
---|
| 477 | dialog.show()
|
---|
| 478 | app.exec_()
|
---|
| 479 |
|
---|