How to use _set_check_state method in lisa

Best Python code snippet using lisa_python

folder.py

Source:folder.py Github

copy

Full Screen

...108 parent = item.parent()109 if parent:110 checked = parent.object.data().checked.all()111 # checked = _all_children_checked(parent) # TEST!112 _set_check_state(parent, checked)113 _check_parents(parent)114def _all_children_checked(item):115 """Set the checkstate of all children of an item."""116 nrOfChildren = item.childCount()117 for n in range(nrOfChildren):118 child = item.child(n) 119 checked = child.checkState(0) == Qt.Checked120 if not checked: return False121 return True122def _toggle_checked(item):123 "Uncheck if checked and check if unchecked."124 checked = item.checkState(0) == Qt.Checked125 _set_checked(item, not checked)126def _set_checked(item, checked):127 """Check or uncheck an item"""128 _set_check_state(item, checked)129 _check_children(item, checked)130def _set_check_state(item, checked):131 """Ticks or unticks the box"""132 if checked: 133 item.setCheckState(0, Qt.Checked)134 else: 135 item.setCheckState(0, Qt.Unchecked)136def _save_checked(item): 137 """Save the item checked state."""138 files = item.object.files # SLOW139 checked = item.checkState(0) == Qt.Checked140 item.object.folder.dataframe.loc[files, 'checked'] = checked141def _check_children(item, checked):142 """Set the checkstate of all children of an item."""143 nrOfChildren = item.childCount()144 for n in range(nrOfChildren):...

Full Screen

Full Screen

check_list.py

Source:check_list.py Github

copy

Full Screen

...58 item = self.list.item(i)59 if item.checkState() == QtCore.Qt.Checked:60 yield item.text()61 def check_all(self):62 self._set_check_state(QtCore.Qt.Checked)63 def uncheck_all(self):64 self._set_check_state(QtCore.Qt.Unchecked)65 def invert_checked(self):66 for i in range(self.list.count()):67 item = self.list.item(i)68 if item.checkState() == QtCore.Qt.Checked:69 item.setCheckState(QtCore.Qt.Unchecked)70 else:71 item.setCheckState(QtCore.Qt.Checked)72 def check_selected(self):73 for i in range(self.list.count()):74 item = self.list.item(i)75 if item.isSelected():76 item.setCheckState(QtCore.Qt.Checked)77 else:78 item.setCheckState(QtCore.Qt.Unchecked)79 def check_items(self, items: Sequence[str]):80 for item in items:81 for match in self.list.findItems(item, QtCore.Qt.MatchExactly):82 match.setCheckState(QtCore.Qt.Checked)83 def _set_check_state(self, state: QtCore.Qt.CheckState):84 for i in range(self.list.count()):85 self.list.item(i).setCheckState(state)86 def _on_item_changed(self, item: QtWidgets.QListWidgetItem):87 self.item_changed.emit(item)88 def _on_context_menu(self, pos: QtCore.QPoint):89 if len(self.context_menu.actions()) == 0:90 return91 action = self.context_menu.exec_(self.list.mapToGlobal(pos))92 if action is None:93 return94 action_fn = action.data()95 action_fn()96 def _on_filter_changed(self, text: str):97 search_text = text.strip().lower()...

Full Screen

Full Screen

test_legacy_runner.py

Source:test_legacy_runner.py Github

copy

Full Screen

...16log = get_logger("test_legacy")17class ResultStateManagerTestCase(TestCase):18 def test_sequence_running(self) -> None:19 states = legacy_runner.ResultStateManager("legacy", log)20 self._set_check_state(21 states,22 4,23 0,24 0,25 [26 TestStatus.QUEUED,27 TestStatus.QUEUED,28 TestStatus.QUEUED,29 TestStatus.QUEUED,30 ],31 )32 self._set_check_state(33 states,34 4,35 1,36 0,37 [38 TestStatus.RUNNING,39 TestStatus.QUEUED,40 TestStatus.QUEUED,41 TestStatus.QUEUED,42 ],43 )44 self._set_check_state(45 states,46 4,47 1,48 1,49 [50 TestStatus.PASSED,51 TestStatus.QUEUED,52 TestStatus.QUEUED,53 TestStatus.QUEUED,54 ],55 )56 self._set_check_state(57 states,58 4,59 2,60 1,61 [62 TestStatus.PASSED,63 TestStatus.RUNNING,64 TestStatus.QUEUED,65 TestStatus.QUEUED,66 ],67 )68 self._set_check_state(69 states,70 4,71 2,72 2,73 [74 TestStatus.PASSED,75 TestStatus.PASSED,76 TestStatus.QUEUED,77 TestStatus.QUEUED,78 ],79 )80 self._set_check_state(81 states,82 4,83 3,84 2,85 [86 TestStatus.PASSED,87 TestStatus.PASSED,88 TestStatus.RUNNING,89 TestStatus.QUEUED,90 ],91 )92 self._set_check_state(93 states,94 4,95 4,96 3,97 [98 TestStatus.PASSED,99 TestStatus.PASSED,100 TestStatus.PASSED,101 TestStatus.RUNNING,102 ],103 )104 self._set_check_state(105 states,106 4,107 4,108 4,109 [110 TestStatus.PASSED,111 TestStatus.PASSED,112 TestStatus.PASSED,113 TestStatus.PASSED,114 ],115 )116 def _set_check_state(117 self,118 state: legacy_runner.ResultStateManager,119 all_count: int,120 running_count: int,121 completed_count: int,122 expected_statuses: List[TestStatus],123 ) -> None:124 all = self._create_information(all_count, TestStatus.QUEUED)125 running = self._create_information(running_count, TestStatus.RUNNING)126 completed = self._create_information(completed_count, TestStatus.PASSED)127 state.set_states(all, running, completed)128 self.assertListEqual([x.status for x in state._results], expected_statuses)129 def _create_information(130 self, count: int, status: TestStatus...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run lisa automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful