def _del_idle_companies(): IncubusFactory.get_instance().user_event() idle_companies = get_companies_without_payment() if len(idle_companies) <= 0: return company_list.CompanyList(Prime._del_idle_companies__selected, companies=idle_companies).mainloop()
def _notif_double_click(self, dummy): # pylint: disable=W0613 IncubusFactory.get_instance().user_event() selection = self._notif_list.get(self._notif_list.curselection()) if selection.__contains__("Payment"): payment_guid = selection[selection.find("{") + 1:selection.find("}")] payment_obj = payment_model.get_payment_with_guid(payment_guid) if payment_obj is None: return payment_win = payment.PaymentWindow() payment_win.fill_with_payment(payment_obj) payment_win.mainloop()
def __init__(self, state: WidgetState): self._state = state self._credential = QPlainTextEdit(self._state.main_widget) self._selected_account = Account() self._selected_system = System() self._internal_value = "" self._displayed_value = "" self._masked = True toggle_mask = QPushButton("Toggle") toggle_mask.clicked.connect(self._toggle_clicked) copy_pwd = QPushButton("Copy") copy_pwd.clicked.connect(self._copy_clicked) credential_save = QPushButton("Save") credential_save.clicked.connect(self._credential_save_clicked) button_layout = QHBoxLayout() button_layout.addWidget(toggle_mask) button_layout.addWidget(copy_pwd) button_layout.addWidget(credential_save) credential_layout = QVBoxLayout() credential_layout.addWidget(self._credential) credential_layout.addLayout(button_layout) self._state.main_layout.addLayout(credential_layout) self._incubus = IncubusFactory.get_instance()
def __init__(self, state: WidgetState, account_selected_handler): super().__init__(state, account_selected_handler, self._account_select, self._account_add, self._account_del, self._account_change, "Account") self._repainting = False self.flush_layout() self._selected_system = System() self._selected_account = Account() self._repaint_accounts() self._incubus = IncubusFactory.get_instance()
def _execute(asset_guid: str = None): """ Stock update """ backup.execute() assets = imp_asset.get_assets() random.shuffle(assets["assets"]) first_asset = True for asset in assets["assets"]: if asset["type"] != "COMMODITY": continue if "url_suffix" not in asset: continue if asset["url_suffix"] == "": continue if asset_guid is not None and asset["guid"] != asset_guid: continue if first_asset: first_asset = False else: time.sleep(config.CONSTANTS["COMMODITY_SEARCH_SLEEP"]) IncubusFactory.get_instance().user_event() try: url = config.CONSTANTS["COMMODITY_URL"] + asset["url_suffix"] search_input = SearchInput( url=url, post_sleep=config.CONSTANTS["COMMODITY_PAGE_SLEEP"]) quick_median = QuickMedian(search_input) asset["sales_value"] = \ conv_last_usd_val_to_home_curr(asset) \ if quick_median.median == 0 \ else quick_median.median except Exception as update_error: print(f"Commodity search error: { str(update_error) } ") imp_asset.set_assets(assets)
def _edit_data_file(file_name: str): IncubusFactory.get_instance().user_event() full_path = os.path.join(config.CONSTANTS["DATA_DIR_PATH"], file_name) os.system(f"open {full_path}")
def _net_worth(): IncubusFactory.get_instance().user_event() startup_url("net_worth")
def _edit_assets(): IncubusFactory.get_instance().user_event() asset_window = asset_list.AssetListWindow() asset_window.mainloop()
def _list_payment(): IncubusFactory.get_instance().user_event() payment_window = payment_list.PaymentListWindow() payment_window.mainloop()
def _list_invoice(): IncubusFactory.get_instance().user_event() inv_window = invoice_list.InvoiceListWindow() inv_window.mainloop()
def _list_activity(): IncubusFactory.get_instance().user_event() list_window = activity_list.ActivityListWindow() list_window.mainloop()
def _print_label(): IncubusFactory.get_instance().user_event() company_list.CompanyList( Prime._print_label__company_selected).mainloop()
def _pay_tax(): IncubusFactory.get_instance().user_event() pay_income_tax.PayIncomeTax()
def _ecz_activity(): IncubusFactory.get_instance().user_event() startup_url("ecz_activity_comparison")
def _del_idle_companies__selected(companies: List): IncubusFactory.get_instance().user_event() for company in companies: company.delete()
def __init__(self, add_activity: bool = False): # Initialization cell_y = 0 # Main container self._root = tkinter.Tk() if config.TEST_MODE: self._root.title("Kifu [TEST MODE]") else: self._root.title("Kifu") self._root.geometry( str(self._WINDOW_WIDTH) + "x" + str(self._WINDOW_HEIGHT)) # Status label self._status_label = tkinter.Label(master=self._root, text="Welcome to Kifu", font=default_font()) self._status_label.place(x=0, y=cell_y, width=self._WINDOW_WIDTH, height=config.CONSTANTS["GUI_CELL_HEIGHT"]) cell_y += config.CONSTANTS["GUI_CELL_HEIGHT"] # Notifications self._notif_list = tkinter.Listbox(self._root, font=default_font()) self.refresh() self._notif_list.place(x=0, y=cell_y, width=self._WINDOW_WIDTH, height=self._NOTIF_HEIGHT) self._notif_list.bind('<Double-1>', self._notif_double_click) cell_y += self._NOTIF_HEIGHT refresh_button = tkinter.Button(self._root, text="Refresh", command=self.refresh, font=default_font()) refresh_button.place(x=0, y=cell_y) cell_y += config.CONSTANTS["GUI_CELL_HEIGHT"] # Main menu self._menu = tkinter.Menu(self._root, tearoff=0) file_menu = tkinter.Menu(self._menu, tearoff=0) for data_file in file_system.get_data_file_list(): file_menu.add_command( label=data_file, command=lambda df=data_file: Prime._edit_data_file(df)) file_menu.add_separator() file_menu.add_command(label="Show data files", command=Prime._show_data_files) file_menu.add_command(label="Backup data files", command=self._backup_data) file_menu.add_command(label="Exit", command=self._root.quit) self._menu.add_cascade(menu=file_menu, label="File") timesheet_menu = tkinter.Menu(self._menu, tearoff=0) timesheet_menu.add_command(label="Add", command=Prime._add_activity) timesheet_menu.add_command(label="Edit", command=Prime._list_activity) timesheet_menu.add_command(label="Split latest", command=Prime._split_latest_activity) timesheet_menu.add_separator() timesheet_menu.add_command(label="Activity report", command=Prime._activity_report) timesheet_menu.add_command(label="Workdays without activity", command=Prime._workdays_wo_activity) timesheet_menu.add_command(label="Ecz activity comparison", command=Prime._ecz_activity) self._menu.add_cascade(menu=timesheet_menu, label="Timesheet") timesheet_menu.add_command(label="Invoices", command=Prime._list_invoice) payment_menu = tkinter.Menu(self._menu, tearoff=0) payment_menu.add_command(label="Add", command=Prime._add_payment) payment_menu.add_command(label="Edit", command=Prime._list_payment) payment_menu.add_command(label="Delete completed payments", command=self._del_completed_payments) payment_menu.add_separator() payment_menu.add_command(label="Book CC statement", command=Prime._add_cc_statement) payment_menu.add_command(label="Book cash movement", command=Prime._add_cash) payment_menu.add_command(label="Invest", command=Prime._invest) payment_menu.add_command(label="Pay VAT", command=Prime._pay_vat) payment_menu.add_command(label="Pay income tax", command=Prime._pay_tax) payment_menu.add_separator() payment_menu.add_command(label="Reconciliation", command=Prime._reconciliation) payment_menu.add_command(label="Income tax rates", command=Prime._inc_tax_rates) payment_menu.add_command(label="IBAN list", command=Prime._iban_list) payment_menu.add_command(label="Address book", command=Prime._address_book) payment_menu.add_command(label="Tax info", command=Prime._tax_info) self._menu.add_cascade(menu=payment_menu, label="Payment") asset_menu = tkinter.Menu(self._menu, tearoff=0) asset_menu.add_separator() asset_menu.add_command(label="Edit assets", command=Prime._edit_assets) asset_menu.add_separator() asset_menu.add_command(label="Net worth", command=Prime._net_worth) asset_menu.add_command(label="Account balances", command=Prime._bank_account_balance) asset_menu.add_command(label="Currency balances", command=Prime._currency_account) asset_menu.add_command(label="Asset profit", command=Prime._asset_profit) asset_menu.add_separator() self._menu.add_cascade(menu=asset_menu, label="Asset") budget_menu = tkinter.Menu(self._menu, tearoff=0) budget_menu.add_command(label="Akbank statement", command=Prime._akbank_statement) budget_menu.add_command(label="Plan", command=Prime._budget_plan) budget_menu.add_command(label="Plan vs actual", command=Prime._budget_plan_vs_actual) budget_menu.add_command(label="Salary simulation", command=Prime._salary_simulation) self._menu.add_cascade(menu=budget_menu, label="Budget") util_menu = tkinter.Menu(self._menu, tearoff=0) util_menu.add_command(label="Update currencies", command=self._currency_update) util_menu.add_command(label="Update commodities", command=self._commodity_update) util_menu.add_command(label="Print labels", command=self._print_label) util_menu.add_command(label="Delete idle companies", command=Prime._del_idle_companies) self._menu.add_cascade(menu=util_menu, label="Util") # Flush self._root.configure(menu=self._menu) configure_treeview_style() if add_activity: Prime._add_activity() IncubusFactory.get_instance().start(15)
def _del_completed_payments(self): IncubusFactory.get_instance().user_event() self._set_status("Deleting completed payments") delete_completed_payments() self._set_status("Deletion complete") self.refresh()
def _pay_vat(): IncubusFactory.get_instance().user_event() pay_vat.PayVat()
def _inc_tax_rates(): IncubusFactory.get_instance().user_event() startup_url("income_tax_rates")
def _print_label__company_selected(companies: List): IncubusFactory.get_instance().user_event() CompanyLabel().generate(companies)
def _iban_list(): IncubusFactory.get_instance().user_event() startup_url("iban_list")