This repository has been archived on 2024-12-06. You can view files and clone it, but cannot push or open issues or pull requests.
PyBitmessage-2024-12-06/src/mockpb/kivy_main.py

41 lines
1.2 KiB
Python
Raw Normal View History

2022-10-11 09:21:05 +02:00
# pylint: disable=unused-import, wrong-import-position, ungrouped-imports
# flake8: noqa:E401, E402
"""Mock kivy app with mock threads."""
2022-10-11 09:21:05 +02:00
import os
from kivy.config import Config
2024-03-20 02:57:38 +01:00
from pybitmessage.mockpb import multiqueue
from pybitmessage import state
2022-09-19 18:04:34 +02:00
if os.environ.get("INSTALL_TESTS", False):
Config.set("graphics", "height", 1280)
Config.set("graphics", "width", 720)
Config.set("graphics", "position", "custom")
Config.set("graphics", "top", 0)
Config.set("graphics", "left", 0)
2022-10-11 09:21:05 +02:00
2024-03-20 02:57:38 +01:00
from pybitmessage.mockpb.class_addressGenerator import FakeAddressGenerator # noqa:E402
2022-10-11 09:21:05 +02:00
from pybitmessage.bitmessagekivy.mpybit import NavigateApp # noqa:E402
2024-03-20 02:57:38 +01:00
from pybitmessage.mockpb import network # noqa:E402
2022-09-19 18:04:34 +02:00
stats = network.stats
objectracker = network.objectracker
def main():
"""main method for starting threads"""
# Start the address generation thread
addressGeneratorThread = FakeAddressGenerator()
# close the main program even if there are threads left
addressGeneratorThread.daemon = True
addressGeneratorThread.start()
state.kivyapp = NavigateApp()
state.kivyapp.run()
2022-11-08 08:30:49 +01:00
addressGeneratorThread.stopThread()
2022-09-19 18:04:34 +02:00
if __name__ == "__main__":
main()