def __init__(self): super().__init__() self.proxylist = [] self.proxylist_obj = None self.proxylist_thread = None self.proxyModel = TableModel('Id', 'Country', 'Url', 'Response_time', 'Used', 'Error') self.sortProxyModel = SortFilterProxyModel(self.proxyModel) self.rootContext().setContextProperty('sortProxyModel', self.sortProxyModel)
def __init__(self, parent=None): super(FrozenTableView, self).__init__(parent) self.model = TableModel() self.setSelectionBehavior(QAbstractItemView.SelectRows) self.setSelectionMode(QAbstractItemView.SingleSelection) self.verticalHeader().setVisible(False) self.setSortingEnabled(True) self.setModel(self.model) self.is_updating = False
def __init__(self): super().__init__() self.setWindowTitle("Single word translations") self.table = QTableView() self.table.verticalHeader().setDefaultSectionSize(50) self.table.horizontalHeader().setDefaultSectionSize(150) self.model = TableModel() self.table.setModel(self.model) self.setLayout(QVBoxLayout()) self.layout().addWidget(self.table)
def __init__(self): super().__init__() self.items = [] self.parse_obj = None self.parse_thread = None self.itemsModel = TableModel('Id', 'Dt', 'Name', 'Price', 'Author', 'Address', 'Phone') self.sortItemsModel = SortFilterProxyModel(self.itemsModel) self.rootContext().setContextProperty('sortItemsModel', self.sortItemsModel)
def test_table_array_shape_ndim(filename, tmp_path): file_path = tmp_path / filename with TableModel() as x: x.table = [( 42, 37.5, 'STRING', [[37.5, 38.0], [39.0, 40.0], [41.0, 42.0]], [[37.5, 38.0], [39.0, 40.0], [41.0, 42.0]], )] assert x.table.dtype == [ ('int16_column', '=i2'), ('float32_column', '=f4'), ('ascii_column', 'S64'), ('float32_column_with_shape', '=f4', (3, 2)), ('float32_column_with_ndim', '=f4', (3, 2)), ] x.save(file_path) with TableModel(file_path) as x: assert x.table.dtype == [ ('int16_column', '=i2'), ('float32_column', '=f4'), ('ascii_column', 'S64'), ('float32_column_with_shape', '=f4', (3, 2)), ('float32_column_with_ndim', '=f4', (3, 2)), ] with TableModel() as x: with pytest.raises(ValueError): x.table = [( 42, 37.5, 'STRING', # This element should fail because it's shape is (2, 2) and not (3, 2): [[37.5, 38.0], [39.0, 40.0]], [[37.5, 38.0], [39.0, 40.0], [41.0, 42.0]], )]
def display_table(self, tables): for tab, table in tables.items(): view = getattr(self, "{}_table".format(tab)) model = TableModel(table[1], table[0]) model.data_changed.connect(self.update_data) view.setModel(model) view.setColumnHidden(0, True) self.ca_addr_list.clear() self.ca_addr_list.addItems( self.db.configs.find_one({ "config": "EPICS_CA_ADDR_LIST" }).get("ips"))
def post(): if request.args: return {"Message ":"Unsupported Action ; query parameters are not allowed"},403 data = request.get_json() if data == None: return {'Message ': "Request body cannot be empty"}, 403 elif not request.json : return {"Message ": "Unsupported format"}, 400 else: #taking the current dat and time tstamp = datetime.datetime.now() #if authorized by is not given by the user, an message will be displayed if 'authorized_by' not in data[1]: return {"Message ": "Please provide the key 'authorized_by' and your mail id as its value"},500 #storing authorized_by auth_by = data[1]['authorized_by'] #checking if the person is authorized to make an entry from the Master table record_user_id = Master_entries.query.filter_by(user_name = auth_by).first() if record_user_id == None: return {"Message " : "You are not authorized to make an entry!! Please contact Sree Harsha Chintamani"},401 master_user_dict = record_user_id.json2() int_userID = master_user_dict['int_user_id'] active_status = master_user_dict['active'] dict_userIDs = data[0] for j in range(0,len(dict_userIDs['user_id'])): if active_status == False: return {"Message " : "You are only authorized to read an entry!! Please contact Sree Harsha Chintamani"},401 new_record = TableModel('phoenix_windxplore', dict_userIDs['user_id'][j],'1', tstamp,'accepted') new_record1 = Accepted_entries(int_userID,'insert', "phoenix_windxplore", dict_userIDs['user_id'][j],'1', tstamp,'accepted') db.session.add(new_record) try : db.session.commit() except : return {"Message ": "Could not update in the Database!"}, 500 db.session.add(new_record1) try : db.session.commit() except : return {"Message ": "Could not update in the local Database!"},500 return {"Message " : "New record(s) added successfully"}, 200
def __init__(self): self.logModel = TableModel('Time', 'Type', 'Message') self.rootContext().setContextProperty('logModel', self.logModel)