Modules¶
- The main modules in this python package are:
- trellopy.py - consisting of one Controller class
- boards.py - consisting of one Board, BoardList and BoardListCard classs
- members.py - consisting of one Member class
- backend.py - consisting of one Operator class
trellopy.py¶
The controller object is the main interface to the entire package. Use this to make new boards, get boards, add new members, show all boards, and to show all members.
Start by importing the python package:
>>> import trellopy
Get an instance of the controller like so:
>>> controller = trellopy.Controller()
- class trellopy.trellopy.Controller[source]¶
- __init__()[source]¶
Initializes a Controller class. It consists of a single _operator instance:
self._operator = Operator()
- get_board(board_name)[source]¶
Get the board that has the name board_name.
Parameters: board_name – The name of the board you want to get. Returns: A Board class, with Board.board populated with board data.
- get_member(member_name)[source]¶
Get existing member with name member_name
Parameters: member_name – The name of the member. Returns: A Member class, with Members.person populated with name.
- new_board(board_name)[source]¶
Create a new board with name board_name.
Parameters: board_name – The name you want the board to have. Returns: A Board class, with name attribute board_name.
- new_member(member_name)[source]¶
Add a new member with name member_name
Parameters: member_name – The name of the member. Returns: A Member class, with Members.person populated with name.
boards.py¶
Once we have an instance of Controller as described above, operations of boards can be done. When a new board is initialized, a simple dict is saved to the database. The names of the boards must be unique.
>>> import trellopy
>>> controller = trellopy.Controller()
>>> board_1 = controller.new_board('Board')
>>> board_2 = controller.get_board('Bored')
- class trellopy.boards.Board(name, data=None)[source]¶
- __init__(name, data=None)[source]¶
Initializes an Operator instance. The entire board is represented as a dict with the following attributes and defaults:
self.board = {} self.board['name'] : Name of the board self.board['lists'] : initialized as "None" self.board['archived'] : initialized as "False" self.board['labels'] : initialized as "None"
Parameters: - name (str.) – Name of the board
- data (dict.) – Populate the board with data
- add_label(label_name)[source]¶
Add a label to the board
Parameters: label_name (str.) – The name of label
- add_list(list_name)[source]¶
Add a list to the board. This method updates the board.
Parameters: list_name (str.) – Name of the list Returns: List as an instance of BoardList
- archive()[source]¶
Sets the archived flag to True. This method updates the board.
Parameters: None – Call it like it is.
- get_list(list_name)[source]¶
Get a list from the board
Parameters: list_name (str.) – Name of the list Returns: List as an instance of BoardList
- in_database(name)[source]¶
Check if baord is already in the database
Parameters: name (str.) – Name of the board Returns: True if board exists, False if it does not.
- rename(new_name)[source]¶
Renames the board. This method updates the board.
Parameters: new_name (str.) – The new name of board.
- rename_label(label, new_name)[source]¶
Rename the label on the board
Parameters: - label (str.) – The original name of label
- new_name (str.) – The new name of label
A List class is represented as follows in the database.
>>> import trellopy
>>> controller = trellopy.Controller()
>>> board_1 = controller.new_board('Board')
>>> list_1 = board_1.get_list('List')
- class trellopy.boards.BoardList(from_dict=None, *tuples, **dicts)[source]¶
- __init__(from_dict=None, *tuples, **dicts)[source]¶
Represents each list in a board. Cards tied to this list is implemented as a list of dicts. The list object itself is represented as a dict too.
self.lizt = {} self.lizt['board'] : Board the list belongs to self.lizt['name'] : Name of the list self.lizt['cards'] : List of cards associated. Default is None self.lizt['archived'] : The archive flag. Default is False.
Parameters: from_dict (dict.) – If the list is to be pre-populated from a dict.
- add_card(card)[source]¶
Add a card to the list. If the card is of type string, a new card is created. If it is an instance of BoardListCard then a copy of it appended to the current list of cards.
>>> list_one = board_one.get_list('Simplist') >>> list_two = board_two.get_list('Unlisted') >>> card_one = list_one.get_card('Simple Card') >>> list_two.add_card(card_one) >>> list_two.add_card('Another Card')
Parameters: card (str. or BoardListCard) – A card instance or name of card
- get_card(card_name)[source]¶
Get a card from the list
Parameters: card_name (str.) – The name of card Returns: Instance of BoardListCard
- get_order()[source]¶
Get order of cards in list
>>> sample_list.get_order() 0 Card A 1 Another Card 2 Cardigan 3 Red Card
Parameters: None – Call it like it is. Returns: An output of lists
This is implemented as a simple dict. The property “name” must exist, as all cards must have a name.
>>> import trellopy
>>> controller = trellopy.Controller()
>>> board_1 = controller.new_board('Board')
>>> list_1 = board_1.get_list('List')
>>> card_1 = list_1.get_card('Card')
- class trellopy.boards.BoardListCard(name, data=None)[source]¶
- __init__(name, data=None)[source]¶
Initializes the card as a dict.
self.card = {} self.card['name'] : Name of card self.card['archived'] : Archive flag. Default is False self.card['labeled'] : Label attached to card. Default is None self.card['assigned'] : List of members the card is assigned to. Default is None.
Parameters: - name (str) – Name of card
- data (dict) – Data to be pre-populated