Example #1
0
    def refresh_available_windows(self, *args, **kwargs):
        """Refresh each grid table with available tables

        After an app is selected, other grids should not be able to select it as well.
        """
        dpg_core.log_debug(f"Refreshing available windows for table {self.id}")
        active_windows = set(self.ACTIVE_WINDOWS)
        available_windows = active_windows - self._allocated_windows
        grid_mapping = defaultdict(list)
        for row in range(1, self._nrows + 1):
            dpg_core.clear_table(f"{self._id}_{row}_table")

            selected_active_windows = set(
                self._grid_mapping[row]) & active_windows
            grid_mapping[row] = list(selected_active_windows)

            windows = sorted(list(available_windows | selected_active_windows))
            for n, name in enumerate(windows):
                dpg_core.add_row(f"{self._id}_{row}_table", [name])

                if name in selected_active_windows:
                    dpg_core.set_table_selection(f"{self._id}_{row}_table", n,
                                                 0, True)

        self._grid_mapping = grid_mapping
        dpg_core.log_debug(f"Refreshed available windows for table {self.id}")
Example #2
0
 def clear_table(self):
     for workout in self._composed_workout:
         workout["Sets"] = 0
         workout["Reps"] = 0
     core.clear_table("workout_table")
     for workout in self._composed_workout:
         core.add_row("workout_table", list(workout.values()))
Example #3
0
def update_password_table():
    """Update password table contents.

    Clear the all contents in the password table,
    and recreate table entirely.
    """

    core.clear_table('##password_table')

    try:
        password_infos = model.select_all_items()
    except Exception:
        logger.add_error_message('Failed to fetch passwords.')
        return

    if password_infos:
        for password_info in password_infos:
            core.add_row('##password_table', [
                password_info.row_id,
                password_info.title,
                password_info.identifier,
                format_password(password_info.password.decode()),
                password_info.note,
            ])
    logger.add_info_message('Password table was updated.')
Example #4
0
 def __render(self, sender, data):
     """Run every frame to update the GUI.
     Updates the table by clearing it and inserting rows with the data.
     """
     dpg.clear_table('Files')
     for f in self.files_list:
         dpg.add_row('Files', [f['path'], f['name']])
Example #5
0
 def __render(self, sender, data):
     """Run every frame to update the GUI.
     Updates the table by clearing it and inserting rows with the data.
     """
     dpg.clear_table('Todos')
     for todo in self.todos:
         dpg.add_row('Todos', [todo['id'], todo['content'], todo['done']])
Example #6
0
 def __render(self, sender, data):
     """Run every frame to update the GUI.
     Updates the table by clearing it and inserting rows with the data.
     """
     dpg.clear_table("Stocks")
     for stock in self.stocks:
         dpg.add_row(
             "Stocks",
             [stock["Stock"], stock["Prediction"], stock["Confidence"]])
Example #7
0
    def render(self, entries: List[Entry]) -> None:
        """
        Checks if entries in parent have updated
        If so it'll clear and re-render the table
        :param entries: Entries passed in parent class
        :return: Updated table with new data
        """

        if id(entries) == self.prior_id:
            return
        self.prior_id = id(entries)
        c.clear_table(self.table_name)
        for entry in entries:
            self.add_row_to_entry_table(entry)