Exemple #1
0
 def __init__(self, table, column, row, expected_cell_map):
     Widget.__init__(self, table)
     self.table = table
     self.column = column
     self.row = row
     self.expected_cell = expected_cell_map
     self.find_search_region()
Exemple #2
0
 def click(self, offset=None):
     Widget.click(self, offset)
     self.selected = True
     if not self.group:
         return
     for radio_button in radio_groups[self.group_key()]:
         if radio_button != self:
             radio_button.selected = False
Exemple #3
0
 def __init__(self, parent, name, group=None, selected=False):
     Widget.__init__(self, parent, name)
     self.group = group
     self.selected = selected
     if group:
         key = self.group_key()
         if key not in radio_groups:
             radio_groups[key] = []
         radio_groups[key].append(self)
Exemple #4
0
 def __init__(self, parent, source_widget, name=None):
     if not name:
         name = to_snakecase(self.__class__.__name__)
     Widget.__init__(self, parent, name)
     # Note: source_widget must have a selected attribute.
     #       eg, a radio button
     self.source_widget = source_widget
     self.widgets = []
     self.add_widget_methods()
     self.contains()
Exemple #5
0
 def __init__(self, table, name):
     Widget.__init__(self, table, name)
     self.table = table
     # create a button for the column header
     # FIXME: It is assumed that all tables have headers in
     #        order to function correctly.
     self.header = Button(self, "__header__")
     self.header_region = None
     self.scrolls_from_left = None
     self.cell = {}
     self.load_expected_cells()
    def __init__(self, parent, name):
        Widget.__init__(self, parent, name)

        # create a virtual widget to hold our buttons
        # TODO: is it worth it to create a Scrollbar widget?
        self._scrollbar = Widget(self, "__scrollbar__")
        # create the 4 directional scrollbar buttons
        self._top_button = Button(self._scrollbar, "top")
        self._bottom_button = Button(self._scrollbar, "bottom")
        self._left_button = Button(self._scrollbar, "left")
        self._right_button = Button(self._scrollbar, "right")
Exemple #7
0
 def __init__(self, table, index, scrolls_from_top, page_index):
     Widget.__init__(self, table)
     self.table = table
     self.index = index
     self.page_index = page_index
     # FIXME: instead of requiring the page_index be passed,
     #        derive it
     #if index < self.table.rows_per_page:
     #    self.page_index = index
     #else:
     #    self.page_index = self.table.rows_per_page - 1
     self.scrolls_from_top = scrolls_from_top
Exemple #8
0
    def __setattr__(self, attr, val):
        """ Syntactic sugar method so that text can be
            'assigned' to the textfield to be typed. ie,

            username = TextField(...)
            username.text = "bob"
        """
        if attr != 'text':
            Widget.__setattr__(self, attr, val)
        else:
            self.set_text(val)
            
Exemple #9
0
    def capture_screenshots(self):
        self.header.capture_screenshots()
        # prompt the user for what cells they expect to see
        # under this column
        response = raw_input("Capture screenshot(s) of expected cell(s) under this column? ")
        if not response.startswith('y'):
            return

        expected_cells = raw_input("List the cells you expect to see under this column, " +
                                   "separated by commas:\n").replace(' ', '').split(',')
        for cell_name in expected_cells:
            cell = Widget(self, cell_name)
            cell.capture_screenshots()