def __init__(self, folderName, debug=False):
        super(Main, self).__init__()  # noqa

        self.ui = None

        Main.DEBUG = debug
        self.initializeApp()
        self.accountBookWrapper = AccountBookWrapper.wrapperForFolder(
            folderName)  # wrapper is of java type 'AccountBookWrapper'
        self.setCurrentBook(self.accountBookWrapper)
Exemplo n.º 2
0
from com.moneydance.modules.features.invextension import TransactionValues

#%%
print("prove moneydance data file exists, load it into java File object")
mdTestFolder = "resources\\testMD02.moneydance"
print("Moneydance Data File exists? {0}, in {1}".format(
    os.path.exists(mdTestFolder), mdTestFolder))
mdFileJava = File(mdTestFolder)
last_modded_long = mdFileJava.lastModified()  # type is java class 'JLong'
last_modded_ts = pd.Timestamp(int(last_modded_long) / 1000,
                              unit='s',
                              tz='US/Central')
print("data folder last modified: {0}".format(last_modded_ts.isoformat()))
#%%
print("now get AccountBookWrapper, accountBook, and rootAccount")
wrapper = AccountBookWrapper.wrapperForFolder(
    mdFileJava)  # wrapper is of java type 'AccountBookWrapper'
wrapper.loadDataModel(None)
accountBook = wrapper.getBook()
root_account = accountBook.getRootAccount()
#%%
print(
    "call up a Report Configuration object from investment reports suitable for testing"
)
reportConfig = ReportConfig.getTestReportConfig(root_account, False)
print("Here is that report config: \n{0}".format(reportConfig))
#%%
print("now call up a 'BulkSecInfo object from investment reports")
bulkSecInfo = BulkSecInfo(accountBook, reportConfig)

#%%
print("and list out currency price data from the 'BulkSecInfo object...")
#%%
print("Get a windows helper")
winHelper = WinHelper()
#%%
print("initialize main...")
main = Main()
main.initializeApp(winHelper, prefsFile)
#%%
print("prove moneydance data file exists, load it into java File object")
mdTestFolder = "resources\\testMD02.moneydance"
print("Moneydance Data File exists? {0}, in {1}".format(os.path.exists(mdTestFolder), mdTestFolder))
mdFileJava = File(mdTestFolder)
#%%
print("get test moneydance file from this project, attach it to main, this will start the application gui...")
main.setInitialFile(mdFileJava)
startBook = AccountBookWrapper.wrapperForFolder(mdFileJava)
main.setCurrentBook(startBook)

#%%
print("initialize a moneydance gui object")
mdGui = MoneydanceGUI(main)
#%%
print("print all the accounts, find the checking account and assign it to a variable...")
root_account = mdGui.getCurrentBook().getRootAccount()
for account in root_account.getSubAccounts():
    account_name = account.getAccountName()
    print(account_name)
    if account_name == 'Checking':
        print("found Checking Account...uuid {0}".format(account.getUUID()))
        checking_account = account
#%%