How to use _setup_signals method in avocado

Best Python code snippet using avocado_python

ireminder.py

Source:ireminder.py Github

copy

Full Screen

...27 self.due_time.setTime(QtCore.QTime.currentTime())28 # making an instance of message window29 self.message_window = MessageWindow()30 # Setting up the Signals31 self._setup_signals()32 # --> End __init__33 def _setup_signals(self):34 """35 Connecting the signals of the UI to the their use36 """37 self.ok_button.clicked.connect(self._ok_button_clicked)38 self.cancel_button.clicked.connect(self._cancel_button_clicked)39 # --> End _setup_signals40 def _cancel_button_clicked(self):41 """42 Closing the main window after cancel button was clicked43 """44 # Close the app45 self.close()46 # --> End _cancel_button_clicked47 def _ok_button_clicked(self):48 """49 Set up the reminder system once the OK button was clicked50 """51 # Collecting the info from the window52 close_reminder = self.close_after.checkState()53 reminder_message = self.messgae_value.text()54 reminder_due_time = self.due_time.text()55 # Converting the time to QTime type56 hours = int(reminder_due_time.split(":")[0])57 minutes = int(reminder_due_time.split(":")[1].split(" ")[0])58 am_pm = reminder_due_time.split(":")[1].split(" ")[1]59 # Converting the time to 24 the60 if am_pm == "PM":61 hours += 1262 reminder_due_time = QtCore.QTime(hours, minutes)63 # Closing the main window64 self.close()65 # Sending the data to the reminder window66 self._reminder(reminder_message, close_reminder, reminder_due_time)67 # --> _ok_button_clicked68 def _reminder(self, msg, close_it, due):69 """70 Based on the input value, it'll remind the user via71 splash screen, and then it'll shows the a message72 :arg msg: (optional) Message to be shown when alarm goes off73 :type msg: str74 :arg close_it: Boolean value that causes whether the message \75 window to be closed after 10 sec76 :type close_it; boolean77 :arg due: Time to remind the user, example --> 10:30, or, 17:4378 :type due: str79 :returns: returns the message in a QWidget80 :rtype: QWidget81 """82 # If user didn't specify a message, assign something to message,83 # otherwise use the message that user asked84 if not msg:85 msg = "It is time"86 # While we haven't reached the due time, put the script to sleep87 # for 20 seconds88 while due > QtCore.QTime.currentTime():89 time.sleep(20)90 self.message_window.message_result.setText("<font color='red'\91 size=3> " + msg + " </font>")92 self.message_window.show()93 # If the close itself is on, close the window after 10 sec94 if close_it:95 QtCore.QTimer.singleShot(10000, self.message_window.close)96# --> End ReminderSystem97class MessageWindow(QtGui.QWidget, message_UI.Ui_Form):98 """99 The Message window100 """101 def __init__(self, parent=None):102 """103 Constructing the message window104 """105 super(MessageWindow, self).__init__(parent)106 self.setupUi(self)107 # setting up the signals108 self._setup_signals()109 # --> End __init__110 def _setup_signals(self):111 """112 Setting up the signals of the message window buttons113 """114 self.close_result_window.clicked.connect(self._close_message_window)115 # --> End _setup_signals116 def _close_message_window(self):117 """118 Closing the message window119 """120 self.close()121 # --> End _close_message_window122#---> End MessageWindow123def main():124 """...

Full Screen

Full Screen

setup_cage.py

Source:setup_cage.py Github

copy

Full Screen

...30 def __init__(self, name='', parent=None):31 super(SelectMeshWidget, self).__init__(parent)32 self.name = name33 self._setup_ui()34 self._setup_signals()35 def _setup_ui(self):36 main_layout = QtWidgets.QHBoxLayout()37 self.label = QtWidgets.QLabel(self.name)38 self.label.setMinimumWidth(80)39 self.mesh_le = QtWidgets.QLineEdit()40 self.mesh_le.setReadOnly(True)41 self.select_btn = QtWidgets.QPushButton('<<')42 main_layout.addWidget(self.label)43 main_layout.addWidget(self.mesh_le)44 main_layout.addWidget(self.select_btn)45 self.setLayout(main_layout)46 def _setup_signals(self):47 self.select_btn.clicked.connect(self.add_to_mesh_le)48 def add_to_mesh_le(self):49 currently_selected = pm.selected()50 self.mesh_le.setText(currently_selected[0].name())51 def get_name(self):52 return str(self.mesh_le.text())53class GCDeformerUI(QtWidgets.QDialog):54 _widgets = []55 def __init__(self, parent=None):56 super(GCDeformerUI, self).__init__(parent)57 self._setup_ui()58 self._setup_signals()59 self._widgets.append(self)60 def _setup_ui(self):61 self.setWindowTitle('Green Cage Deformer UI')62 main_layout = QtWidgets.QVBoxLayout()63 self.target_widget = SelectMeshWidget(name='Target Mesh')64 self.cage_widget = SelectMeshWidget(name='Cage Mesh')65 self.setup_cage_btn = QtWidgets.QPushButton('Setup Cage')66 67 main_layout.addWidget(self.target_widget)68 main_layout.addWidget(self.cage_widget)69 main_layout.addWidget(self.setup_cage_btn)70 self.setLayout(main_layout)71 def _setup_signals(self):72 self.setup_cage_btn.clicked.connect(self.setup_cage)73 def setup_cage(self):74 target_mesh = self.target_widget.get_name()75 cage_mesh = self.cage_widget.get_name()76 apply_cage(target_mesh=target_mesh, cage_mesh=cage_mesh)77 @classmethod78 def show_window(cls):79 if cls._widgets:80 cls._widgets[0].close()81 cls._widgets[0].deleteLater()82 cls._widgets.pop()83 ui = cls(parent=get_maya_window())...

Full Screen

Full Screen

core_widget.py

Source:core_widget.py Github

copy

Full Screen

...7class CoreWidget(Gtk.Box):8 def __init__(self):9 super(CoreWidget, self).__init__()10 self._setup_styling()11 self._setup_signals()12 self._load_widgets()13 self.show_all()14 def _setup_styling(self):15 self.set_orientation(1)16 def _setup_signals(self):17 ...18 def _load_widgets(self):19 button = Gtk.Button(label="Click Me!")20 button.connect("clicked", self._hello_world)21 self.add(button)22 def _hello_world(self, widget=None, eve=None):...

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 avocado 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