Skip to content

Instantly share code, notes, and snippets.

@BenjamenMeyer
Last active June 23, 2025 00:01
Show Gist options
  • Select an option

  • Save BenjamenMeyer/c44c361007e191c4da87e55013a2c613 to your computer and use it in GitHub Desktop.

Select an option

Save BenjamenMeyer/c44c361007e191c4da87e55013a2c613 to your computer and use it in GitHub Desktop.
Kivy Base App Debug
import asyncio
import logging
import sys
from kivy.app import async_runTouchApp
from .app import App
async def asyncGui(options):
pass
def main():
lh = logging.StreamHandler(sys.stdout)
lh.setLevel(logging.DEBUG)
lfmt = logging.Formatter(
fmt='[%(asctime)s][%(levelname)s][%(name)s/%(lineno)d][%(threadName)s][]: %(message)s',
)
lf = logging.FileHandler('.tb-dedup.log')
lf.setLevel(logging.DEBUG)
log = logging.getLogger()
log.addHandler(lh)
log.addHandler(lf)
log.setLevel(logging.DEBUG)
loop = asyncio.get_event_loop()
root = App()
loop.run_until_complete(
async_runTouchApp(
root,
async_lib='asyncio',
)
)
loop.close()
if __name__ == "__main__":
sys.exit(main())
import logging
import kivy.app
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.splitter import Splitter
from kivy.uix.textinput import TextInput
from kivy.uix.treeview import TreeView
from kivy.uix.widget import Widget
# +----------------------------------------------------+
# | +--------------+ +-----------+ +-----------+ |
# | Path | <path value> | | Selct Btn | | Search | |
# | +--------------+ +-----------+ +-----------+ |
# | +------------------------------------------------+ |
# | | Tree View | |
# | | root | progress bar | |dedup btn| | |
# | | + layer 1 | progress bar | |dedup btn| | |
# | | | + layer 2 | progress bar | |dedup btn| | |
# | | ..... | |
# | | + layer N | progress bar | |dedup btn| | |
# | +------------------------------------------------+ |
# | +------------------------------------------------+ |
# | | <log data> | |
# | +------------------------------------------------+ |
# +----------------------------------------------------+
LOG = logging.getLogger(__name__)
class theApp(BoxLayout):
def __init__(self, **kwargs):
# force the widget into horizontal boxing so everything goes top-down
kwargs["orientation"] = "horizontal"
super(theApp, self).__init__(**kwargs)
self.selected_directory = ""
# path layout will use vertical boxing so everything goes left to right
self.path_layout = BoxLayout(orientation='vertical')
# [Path] label
self.lbl_path = Label(text="Path")
self.path_layout.add_widget(self.lbl_path)
# Path input box - we'll let the user type it in
self.txt_path = TextInput(text=self.selected_directory)
# probably should add something to validate the text
# and enable/disable the buttons based on the result
self.path_layout.add_widget(self.txt_path)
# Select button to pop-up the File/Direction Selection dialog
self.btn_select_path = Button(text="Select...")
self.btn_select_path.bind(self.select_path)
self.path_layout.add_widget(self.btn_select_path)
# Generate button to be used once the user has selected
# entries in the tree view that is displaying the file system layout
self.btn_generate_plan = Button(text="Generate Plan")
self.btn_generate_plan.bind(self.generate_plan)
self.path_layout.add_widget(self.btn_generate_plan)
# splitter to be able to resize stuff
self.splitter_path = Splitter(sizable_from="top")
self.splitter_path.add_widget(self.path_layout)
# tree view for the file system view
self.filesystem_viewer = TreeView()
self.add_widget(self.splitter_path)
def select_path(self, btn, btn_state):
pass
def generate_plan(self, btn, btn_state):
pass
class App(kivy.app.App):
def build(self):
return theApp()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment