text stringlengths 0 828 |
|---|
This facilitates transfering data from SQLite table row to a XParameterEditor window |
See also: get_table_info() |
"""""" |
# Example of item in table_info: |
# MyDBRow([('cid', 0), ('name', 'id'), ('type', 'integer'), ('notnull', 0), ('dflt_value', None), ('pk', 1)]) |
opbj = a99.Parameters() |
for field_info in table_info.values(): |
p = a99.Parameter() |
if field_info.type == ""integer"": |
p.type = int |
elif field_info.type == ""real"": |
p.type = float |
else: |
p.type = str |
p.name = field_info.name |
if field_info.dflt_value is not None: |
p.value = field_info.dflt_value |
opbj.params.append(p) |
return opbj" |
4158,"def get_frame(): |
""""""Returns a QFrame formatted in a particular way"""""" |
ret = QFrame() |
ret.setLineWidth(1) |
ret.setMidLineWidth(0) |
ret.setFrameShadow(QFrame.Sunken) |
ret.setFrameShape(QFrame.Box) |
return ret" |
4159,"def set_checkbox_value(w, value): |
"""""" |
Sets a checkbox's ""checked"" property + signal blocking + value tolerance |
Args: |
w: QCheckBox instance |
value: something that can be converted to a bool |
"""""" |
save = w.blockSignals(True) |
try: |
w.setChecked(bool(value)) |
finally: |
w.blockSignals(save)" |
4160,"def add_signal(self, signal): |
""""""Adds ""input"" signal to connected signals. |
Internally connects the signal to a control slot."""""" |
self.__signals.append(signal) |
if self.__connected: |
# Connects signal if the current state is ""connected"" |
self.__connect_signal(signal)" |
4161,"def connect_all(self): |
""""""[Re-]connects all signals and slots. |
If already in ""connected"" state, ignores the call. |
"""""" |
if self.__connected: |
return # assert not self.__connected, ""connect_all() already in \""connected\"" state"" |
with self.__lock: |
for signal in self.__signals: |
self.__connect_signal(signal) |
if self.__slot is not None: |
self.__sigDelayed.connect(self.__slot, Qt.QueuedConnection) |
self.__connected = True" |
4162,"def disconnect_all(self): |
""""""Disconnects all signals and slots. |
If already in ""disconnected"" state, ignores the call. |
"""""" |
if not self.__connected: |
return # assert self.__connected, ""disconnect_all() already in \""disconnected\"" state"" |
self.__disconnecting = True |
try: |
for signal in self.__signals: |
signal.disconnect(self.__signalReceived) |
if self.__slot is not None: |
self.__sigDelayed.disconnect(self.__slot) |
self.__connected = False |
finally: |
self.__disconnecting = False" |
4163,"def __signalReceived(self, *args): |
""""""Received signal. Cancel previous timer and store args to be forwarded later."""""" |
if self.__disconnecting: |
return |
with self.__lock: |
self.__args = args |
if self.__rateLimit == 0: |
self.__timer.stop() |
self.__timer.start((self.__delay * 1000) + 1) |
else: |
now = time.time() |
if self.__lastFlushTime is None: |
leakTime = 0 |
else: |
lastFlush = self.__lastFlushTime |
leakTime = max(0, (lastFlush + (1.0 / self.__rateLimit)) - now) |
self.__timer.stop() |
# Note: original was min() below. |
timeout = (max(leakTime, self.__delay) * 1000) + 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.