Exemplo n.º 1
0
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html

import json
import os.path as op

from PyQt5.QtCore import Qt, QSettings, QRect, QObject, pyqtSignal, QLocale
from PyQt5.QtWidgets import QApplication

from core.trans import trget
from core.util import tryint

from core.model.date import clean_format

tr = trget('ui')

# Using json for settings:
# PyQt's QSetting can take just about anything as a value but has a weird,
# opaque format for anything that isn't "Qt native" (not a string, int or
# un-nested list). That format is also fragile and in some case results in
# deserialization bugs. We sidestep this by serializing our values to json.
# Therefore, we only send strings to QSettings


def serialize(v):
    return json.dumps(v)


# We have to keep this around for a while to support old prefs
def deserialize_old(v):
Exemplo n.º 2
0
# Copyright 2019 Virgil Dupras
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html

from core.trans import trget
from ..model.sort import ACCOUNT_SORT_KEY
from .column import Column
from .table import GUITable, Row

trcol = trget('columns')

class ExportAccountTable(GUITable):
    COLUMNS = [
        Column('name', display=trcol("Account")),
        Column('export', display=trcol("Export")),
    ]

    def __init__(self, export_panel):
        self.panel = export_panel
        GUITable.__init__(self, document=export_panel.document)

    # --- Override
    def _fill(self):
        accounts = sorted(self.panel.accounts, key=ACCOUNT_SORT_KEY)
        for account in accounts:
            self.append(ExportAccountTableRow(self, account))


class ExportAccountTableRow(Row):
Exemplo n.º 3
0
from .networth.view import NetWorthView
from .profit.view import ProfitView
from .transaction.view import TransactionView
from .schedule.view import ScheduleView
from .general_ledger.view import GeneralLedgerView
from .docprops_view import DocPropsView
from .new_view import NewView
from .lookup import Lookup
from .export_panel import ExportPanel
from .custom_date_range_panel import CustomDateRangePanel
from .search_field import SearchField
from .date_range_selector import DateRangeSelector
from .import_.csv_options import CSVOptionsWindow
from .import_.window import ImportWindow

tr = trget('ui')

PANETYPE2ICON = {
    PaneType.NetWorth: 'balance_sheet_16',
    PaneType.Profit: 'income_statement_16',
    PaneType.Transaction: 'transaction_table_16',
    PaneType.Account: 'entry_table_16',
    PaneType.Schedule: 'schedules_16',
    PaneType.GeneralLedger: 'gledger_16',
    PaneType.DocProps: 'gledger_16',
}

PANETYPE2VIEWCLASS = {
    PaneType.NetWorth: NetWorthView,
    PaneType.Profit: ProfitView,
    PaneType.Transaction: TransactionView,
Exemplo n.º 4
0
# Copyright 2019 Virgil Dupras
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html

from core.trans import trget
from ..model.sort import ACCOUNT_SORT_KEY
from .column import Column
from .table import GUITable, Row

trcol = trget('columns')


class ExportAccountTable(GUITable):
    COLUMNS = [
        Column('name', display=trcol("Account")),
        Column('export', display=trcol("Export")),
    ]

    def __init__(self, export_panel):
        self.panel = export_panel
        GUITable.__init__(self, document=export_panel.document)

    # --- Override
    def _fill(self):
        accounts = sorted(self.panel.accounts, key=ACCOUNT_SORT_KEY)
        for account in accounts:
            self.append(ExportAccountTableRow(self, account))