def main(): boss_john = Employer( first_name='John', last_name='Paw', company_name="Packrat's Cats", ) employee_mary = Employee( first_name='Mary', last_name='Sue', boss=boss_john, phone=(555, 555, 5555), ) with enaml.imports(): from employee_view import EmployeeView app = QtApplication() view = EmployeeView(employee=employee_mary) view.show() app.start()
def start(self): user_controller_is_running = True self.notification = "Welcome {}!".format(self.user.name) while user_controller_is_running: EmployeeView.clear_terminal() EmployeeView.display_notification( self.notification, self.notification_visibility_time) self.notification = None user_choice = EmployeeView.display_employee_menu() if user_choice == '1': student_list = self.student_container.get_student_list() self.show_user_list(student_list) EmployeeView.getch() elif user_choice == '2': self.notification = "{}, you look pretty!".format( self.user.name) elif user_choice == '3': webbrowser.open('https://www.youtube.com/watch?v=dQw4w9WgXcQ', new=0, autoraise=True) elif user_choice == '9': return True elif user_choice == '0': return False
def main(): # Create an employee with a boss boss_john = Employer( first_name='John', last_name='Paw', company_name="Packrat's Cats", ) employee_mary = Employee( first_name='Mary', last_name='Sue', boss=boss_john, phone=(555, 555, 5555), ) # Import our Enaml EmployeeView with enaml.imports(): from employee_view import EmployeeView app = QtApplication() # Create a view and show it. view = EmployeeView(employee=employee_mary) view.show() app.start()
def create_component(self): with enaml.imports(): from employee_view import EmployeeView from employee import Employer, Employee boss_john = Employer(first_name='John', last_name='Paw', company_name="Packrat's Cats") employee_mary = Employee(first_name='Mary', last_name='Sue', boss=boss_john) view = EmployeeView(employee=employee_mary) return view
def create_component(self): with traits_enaml.imports(): from employee_view import EmployeeView from employee import Employer, Employee boss_john = Employer(first_name="John", last_name="Paw", company_name="Packrat's Cats") employee_mary = Employee(first_name="Mary", last_name="Sue", boss=boss_john) view = EmployeeView(employee=employee_mary) return view
# The employee's phone number as a tuple of 3 ints phone = Tuple(Int()) # This method will be called automatically by atom when the # employee's phone number changes def _phone_changed(self, val): print 'received new phone number for %s: %s' % (self.first_name, val) if __name__ == '__main__': # Create an employee with a boss boss_john = Employer( first_name='John', last_name='Paw', company_name="Packrat's Cats", ) employee_mary = Employee( first_name='Mary', last_name='Sue', boss=boss_john, phone = (555, 555, 5555), ) # Import our Enaml EmployeeView with enaml.imports(): from employee_view import EmployeeView app = QtApplication() # Create a view and show it. view = EmployeeView(employee=employee_mary) view.show() app.start()
phone = Tuple(Int()) # This method will be called automatically by atom when the # employee's phone number changes def _phone_changed(self, val): print 'received new phone number for %s: %s' % (self.first_name, val) if __name__ == '__main__': # Create an employee with a boss boss_john = Employer( first_name='John', last_name='Paw', company_name="Packrat's Cats", ) employee_mary = Employee( first_name='Mary', last_name='Sue', boss=boss_john, phone = (555, 555, 5555), ) # Import our Enaml EmployeeView with enaml.imports(): from employee_view import EmployeeView app = QtApplication() # Create a view and show it. view = EmployeeView(employee=employee_mary) view.show() app.start()
phone = Tuple(Int, Int, Int) # This method is called automatically by traits to get the # default value for the phone number. def _phone_default(self): return (555, 555, 5555) # This method will be called automatically by traits when the # employee's phone number changes def _phone_changed(self, val): print 'received new phone number for %s: %s' % (self.first_name, val) if __name__ == '__main__': # Create an employee with a boss boss_john = Employer(first_name='John', last_name='Paw', company_name="Packrat's Cats") employee_mary = Employee(first_name='Mary', last_name='Sue', boss=boss_john) # Import our Enaml EmployeeView import enaml with enaml.imports(): from employee_view import EmployeeView # Create a view and show it. view = EmployeeView(employee=employee_mary) #view.show()