def upgrade_handler(self): tempdatabase = app_routines.app_home + "/tempdatabase.db" app_routines.check_create_database(tempdatabase) if app_routines.migrate_database(app_routines.db_file, tempdatabase): self.remove_all_rows() print "This might take some time. Stand by." self.basic_chores() self.simplelabel.setText("<b>PS database updated</b>")
def upgrade_handler(self): tempdatabase = app_routines.app_home + "/tempdatabase.db" app_routines.check_create_database(tempdatabase) if app_routines.migrate_database(app_routines.db_file,tempdatabase): self.remove_all_rows() print "This might take some time. Stand by." self.basic_chores() self.simplelabel.setText("<b>PS database updated</b>")
def __init__(self): """ Init block. Nothing interesting here.""" QtGui.QWidget.__init__(self) ## Make sure the database file exists so that we can go ahead and populate the tablewidget. app_routines.check_create_database(app_routines.db_file) self.setWindowTitle("PS2 APP") self.layout = QtGui.QGridLayout(self) self.table = QtGui.QTableWidget(self) self.table.setColumnCount(5) self.table.setMinimumWidth(573) ## check for the number of entries and make enough rows for them self.table.setWordWrap(True) self.table.setSortingEnabled(True) self.table.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self.table.setHorizontalHeaderLabels( ["S.no", "Name", "Location", "Pref", "Notes"]) self.table.verticalHeader().setVisible(False) self.pbar = QtGui.QProgressBar() self.webView = QtWebKit.QWebView(loadProgress=self.pbar.setValue) self.checkbox = QtGui.QCheckBox("Load webpage when clicked", self) self.checkbox.setChecked(True) self.simplelabel = QtGui.QLabel("", self) self.upgrade_button = QtGui.QPushButton("Update PS lists", self) self.layout.addWidget(self.table, 1, 0) self.layout.addWidget(self.webView, 1, 1) self.layout.addWidget(self.checkbox, 2, 0) self.layout.addWidget(self.pbar, 2, 1) self.layout.addWidget(self.simplelabel, 3, 0) self.layout.addWidget(self.upgrade_button, 3, 1, QtCore.Qt.AlignRight) self.basic_chores() self.table.setColumnWidth(0, 35) self.table.setColumnWidth(1, 240) self.table.setColumnWidth(2, 80) self.table.setColumnWidth(3, 50) self.table.setColumnWidth(4, 150) self.table.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.upgrade_button.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Maximum) self.table.setAlternatingRowColors(True) self.table.verticalHeader().setResizeMode( QtGui.QHeaderView.ResizeToContents) self.table.itemClicked.connect(self.fetch_and_set_url) self.table.itemChanged.connect(self.save_changes) self.checkbox.stateChanged.connect(self.set_blank) self.upgrade_button.pressed.connect(self.upgrade_handler) self.webView.loadFinished.connect(self.sane_scroll) self.show()
def __init__(self): """ Init block. Nothing interesting here.""" QtGui.QWidget.__init__(self) ## Make sure the database file exists so that we can go ahead and populate the tablewidget. app_routines.check_create_database(app_routines.db_file) self.setWindowTitle("PS2 APP") self.layout=QtGui.QGridLayout(self) self.table = QtGui.QTableWidget(self) self.table.setColumnCount(5) self.table.setMinimumWidth(573) ## check for the number of entries and make enough rows for them self.table.setWordWrap(True) self.table.setSortingEnabled(True) self.table.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self.table.setHorizontalHeaderLabels(["S.no","Name","Location","Pref","Notes"]) self.table.verticalHeader().setVisible(False) self.pbar = QtGui.QProgressBar() self.webView = QtWebKit.QWebView(loadProgress = self.pbar.setValue) self.checkbox = QtGui.QCheckBox("Load webpage when clicked",self) self.checkbox.setChecked(True) self.simplelabel = QtGui.QLabel("",self) self.upgrade_button = QtGui.QPushButton("Update PS lists",self) self.layout.addWidget(self.table,1,0) self.layout.addWidget(self.webView,1,1) self.layout.addWidget(self.checkbox,2,0) self.layout.addWidget(self.pbar,2,1) self.layout.addWidget(self.simplelabel,3,0) self.layout.addWidget(self.upgrade_button,3,1,QtCore.Qt.AlignRight) self.basic_chores() self.table.setColumnWidth(0,35) self.table.setColumnWidth(1,240) self.table.setColumnWidth(2,80) self.table.setColumnWidth(3,50) self.table.setColumnWidth(4,150) self.table.setSizePolicy(QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.upgrade_button.setSizePolicy(QtGui.QSizePolicy.Maximum,QtGui.QSizePolicy.Maximum) self.table.setAlternatingRowColors(True) self.table.verticalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents); self.table.itemClicked.connect(self.fetch_and_set_url) self.table.itemChanged.connect(self.save_changes) self.checkbox.stateChanged.connect(self.set_blank) self.upgrade_button.pressed.connect(self.upgrade_handler) self.webView.loadFinished.connect(self.sane_scroll) self.show()