ManageVendors module¶
This module handles all operations involving managing vendors.
-
class
ManageVendors.ManageVendorsController(manage_vendors_widget, manage_vendors_ui, settings)¶ Bases:
PyQt5.QtCore.QObjectControls the Manage Vendors tab
- Parameters
manage_vendors_widget (
QWidget) – The manage vendors widget.manage_vendors_ui (
Ui_manage_vendors_tab) – The UI for the manage_vendors_widget.
-
add_vendor(new_vendor)¶ Adds a new vendor to the system if the vendor is valid
- Parameters
new_vendor (
Vendor) – The new vendor to be added- Return type
(<class ‘bool’>, <class ‘str’>)
- Returns
(is_successful, message) A Tuple with the completion status and a message
-
export_vendors_tsv(dir_path)¶ Exports all vendor information as a TSV file to a directory
- Parameters
dir_path – The directory path to export the vendors TSV file to
-
import_vendors_tsv(file_path)¶ Imports the vendors in a TSV file path to the system
- Parameters
file_path – The file path of the vendors TSV file
-
modify_vendor()¶ Updates a vendor’s information in the system if the vendor is valid
-
on_add_vendor_clicked()¶ Handles the signal emitted when the add vendor button is clicked
A dialog is show to allow the user to enter a new vendor’s information. If the information entered is valid, the vendor is added to the system
-
on_export_vendors_clicked()¶ Handles the signal emitted when the export vendors button is clicked.
A folder select dialog is shown to allow the user to select the target directory to export the vendors file to. A vendors TSV file containing all the vendors in the system is then exported
-
on_import_vendors_clicked()¶ Handles the signal emitted when the import vendors button is clicked.
A file select dialog is shown to allow the user to select the vendors TSV file to import. The selected file is then imported.
-
on_name_text_changed(new_name, original_name, validation_label, validate=True)¶ Handles the signal emitted when a vendor’s name is changed
- Parameters
new_name (
str) – The new name entered in the text fieldoriginal_name (
str) – The vendor’s original namevalidation_label (
QLabel) – The label to show validation messagesvalidate (
bool) – This indicates whether the new_name should be validated
-
on_remove_vendor_clicked()¶ Handles the signal emitted when the remove vendor button is clicked.
A confirmation dialog is shown to confirm the removal of the vendor. The vendor is removed from the system if confirmed
-
on_url_text_changed(url, validation_label, validate, non_sushi_check_box)¶ Handles the signal emitted when a vendor’s URL is changed
- Parameters
url (
str) – The URL entered in the text fieldvalidation_label (
QLabel) – The label to show validation messagesvalidate (
bool) – This indicates whether the url should be validatednon_sushi_check_box (
QCheckBox) – The non_sushi checkbox indicator. If checked, the URL is not validated
-
on_vendor_selected(model_index)¶ Handles the signal emitted when a vendor is selected
- Parameters
model_index (
QModelIndex) – An object containing the location of the vendor on the vendor list
-
populate_edit_vendor_view()¶ Populates the edit vendor view with the selected vendors’s information
-
save_all_vendors_to_disk()¶ Saves all the vendors in the system to disk
-
set_edit_vendor_view_state(is_enabled)¶ Enables or disables the elements in the edit vendor view
- Parameters
is_enabled – This indicates whether the edit vendor view should be enabled
-
sort_vendors()¶ Sorts the vendors alphabetically based their names
-
update_name_of_file_and_folder(original_name, new_name)¶
-
update_vendor_names()¶ Updates the local set of vendor names used for validation
-
update_vendors_ui()¶ Updates the UI to show all vendors
-
validate_new_name(new_name, original_name='')¶ Validates a new vendor name
- Parameters
new_name (
str) – The new name to be validatedoriginal_name (
str) – The original name
- Return type
(<class ‘bool’>, <class ‘str’>)
- Returns
(is_successful, message) A Tuple with the completion status and a message
-
validate_url(url)¶ Validates a new url
- Parameters
url (
str) – The URL to be validated- Return type
(<class ‘bool’>, <class ‘str’>)
- Returns
(is_successful, message) A Tuple with the completion status and a message
-
vendors_changed_signal¶
-
class
ManageVendors.Vendor(name, base_url, customer_id, requestor_id, api_key, platform, is_non_sushi, description, companies)¶ Bases:
GeneralUtils.JsonModelThis holds a vendor’s information
- Parameters
name (
str) – The vendor’s unique name (Mandatory)base_url (
str) – The base URL for making sushi report calls (must end with ‘/reports’, mandatory)customer_id (
str) – The customer id used in sushi report callsrequestor_id (
str) – The requestor id id used in sushi report callsapi_key (
str) – The api key id used in sushi report callsplatform (
str) – The platform id used in sushi report callsis_non_sushi (
bool) – This indicates if this vendor is sushi compatibledescription (
str) – A description of this vendorcompanies (
str) – More information about the vendor
-
classmethod
from_json(json_dict)¶ This returns a vendor object using the parameters in a json dict
- Parameters
json_dict (
dict) – A dict containing a vendor’s details- Returns
Vendor