How to use _create_information method in lisa

Best Python code snippet using lisa_python

business_logic.py

Source: business_logic.py Github

copy

Full Screen

...13 :param last_name: Last name of contact14 :return: success code (0)15 """16 LOG.info('Creating new contact information')17 def _create_information(conn, cur, _first_name, _phone_number, _email_address, _last_name=None):18 LOG.debug('Creating information for {0}'.format(_first_name))19 cur.execute("INSERT INTO contacts(first_name, phone_number, email_address, last_name)"20 "values('{0}', '{1}', '{2}', '{3}')"21 .format(_first_name, _phone_number, _email_address, _last_name))22 conn.commit()23 LOG.info("Successfully create contact information for {0}".format(_first_name))24 return self.do_db_transaction(_create_information, first_name, phone_number, email_address, last_name)25 def delete_information(self, contact_id):26 """27 This the function that carries out the delete operation28 :param contact_id: unique id of the contact you want to delete29 :return: 030 """31 if not contact_id:...

Full Screen

Full Screen

information_widget.py

Source: information_widget.py Github

copy

Full Screen

...20 def __init__(self, parent: QWidget = None) -> None:21 super().__init__(parent)22 self._layout = QFormLayout()23 self.setLayout(self._layout)24 self._create_information()25 @pyqtSlot(float, DistanceState)26 def update_distance(self, distance: float, state: DistanceState) -> None:27 """Updates distance to the corresponding information label.28 The text color is red if is a warning state; otherwise black.29 Arguments:30 distance: It is rounded to two decimal places.31 state: The state of the distance.32 """33 self.information["distance"].setNum(round(distance, 2))34 color: TextColor = TextColor.BLACK35 if state is DistanceState.WARNING:36 color = TextColor.RED37 self.information["distance"].set_color(color.value)38 @pyqtSlot(int, TimeState)39 def update_time(self, time: int, state: TimeState) -> None:40 """Updates time to the corresponding information label.41 The text color is red if is a break state; otherwise black.42 Arguments:43 time: Time to update, in seconds.44 state: The state of the time.45 """46 time_str = f"{(time /​/​ 60):02d}:{(time % 60):02d}"47 self.information["time"].setText(time_str)48 self.information["time-state"].setText(state.name.lower())49 color: TextColor = TextColor.BLACK50 if state is TimeState.BREAK:51 color = TextColor.RED52 self.information["time"].set_color(color.value)53 self.information["time-state"].set_color(color.value)54 @pyqtSlot(PostureLabel, str)55 def update_posture(self, posture: PostureLabel, detail: str) -> None:56 """Updates posture and its detail to the corresponding information label.57 The text color is red if is a slump posture; otherwise black.58 Arguments:59 posture: The label of the posture.60 detail: The extra information to tell about the posture.61 """62 self.information["posture"].setText(posture.name.lower())63 # wraps after colons64 wrapped_detail: str = detail.replace(":", ":\n")65 self.information["posture-detail"].setText(wrapped_detail)66 color: TextColor = TextColor.BLACK67 if posture is PostureLabel.SLUMP:68 color = TextColor.RED69 self.information["posture"].set_color(color.value)70 self.information["posture-detail"].set_color(color.value)71 @pyqtSlot(int)72 def update_brightness(self, brightness: int) -> None:73 self.information["brightness"].setNum(brightness)74 # To show and hide the row of QFormLayout,75 # extra effort is required.76 def hide(self, info: str) -> None:77 """Hides the whole row that contains the field info."""78 row, _ = self._layout.getWidgetPosition(self.information[info])79 self._layout.itemAt(row, QFormLayout.LabelRole).widget().hide()80 self._layout.itemAt(row, QFormLayout.FieldRole).widget().hide()81 def show(self, info: str) -> None:82 """Shows the whole row that contains the field info."""83 row, _ = self._layout.getWidgetPosition(self.information[info])84 self._layout.itemAt(row, QFormLayout.LabelRole).widget().show()85 self._layout.itemAt(row, QFormLayout.FieldRole).widget().show()86 def change_language(self, lang: Language) -> None:87 lang_file = to_abs_path(f"./​gui/​lang/​{lang.name.lower()}.json")88 with open(lang_file, mode="r", encoding="utf-8") as f:89 lang_map = json.load(f)[type(self).__name__]90 for name, info in self.information.items():91 row_no, _ = self._layout.getWidgetPosition(info)92 self._layout.itemAt(row_no, QFormLayout.LabelRole).widget().setText(93 lang_map[name]94 )95 def _create_information(self) -> None:96 """Creates the labels for information."""97 information: Dict[str, str] = {98 "distance": "Face Distance:",99 "posture": "Posture Detect:",100 "posture-detail": "Detail:",101 "time": "Focus Time:",102 "time-state": "Timer State:",103 "brightness": "Screen Brightness:",104 }105 self.information: Dict[str, Label] = {}106 font_size: int = 15107 for name, description in information.items():108 # Notice that if the line wrap isn't set to True,109 # the label might grow and affect size of other widget....

Full Screen

Full Screen

test_legacy_runner.py

Source: test_legacy_runner.py Github

copy

Full Screen

...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: TestStatus131 ) -> List[Dict[str, str]]:132 results: List[Dict[str, str]] = []133 for i in range(count):134 result = {"name": f"name{i}"}135 results.append(result)136 if status == TestStatus.QUEUED:137 continue138 result["image"] = f"image{i}"139 result["location"] = f"location{i}"140 if status == TestStatus.RUNNING:141 result["status"] = "RUNNING"142 elif status == TestStatus.PASSED:143 result["status"] = "PASS"...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

How To Handle Multiple Windows In Selenium Python

Automating testing is a crucial step in the development pipeline of a software product. In an agile development environment, where there is continuous development, deployment, and maintenance of software products, automation testing ensures that the end software products delivered are error-free.

Joomla Testing Guide: How To Test Joomla Websites

Before we discuss the Joomla testing, let us understand the fundamentals of Joomla and how this content management system allows you to create and maintain web-based applications or websites without having to write and implement complex coding requirements.

Starting & growing a QA Testing career

The QA testing career includes following an often long, winding road filled with fun, chaos, challenges, and complexity. Financially, the spectrum is broad and influenced by location, company type, company size, and the QA tester’s experience level. QA testing is a profitable, enjoyable, and thriving career choice.

The Art of Testing the Untestable

It’s strange to hear someone declare, “This can’t be tested.” In reply, I contend that everything can be tested. However, one must be pleased with the outcome of testing, which might include failure, financial loss, or personal injury. Could anything be tested when a claim is made with this understanding?

How To Create Custom Menus with CSS Select

When it comes to UI components, there are two versatile methods that we can use to build it for your website: either we can use prebuilt components from a well-known library or framework, or we can develop our UI components from scratch.

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