Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: KivyMD and Launcher overhaul #3934

Open
wants to merge 57 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
4f3fbeb
kivymd testing
Silvris Feb 27, 2024
aa1ddb5
update kivymd to 2.0.1dev
Silvris Feb 28, 2024
db95e9a
attempt launcher changes, port scroll to main soon
Silvris Mar 2, 2024
5ab41c3
icons are actually showing now
Silvris Mar 2, 2024
2b51c6b
Merge remote-tracking branch 'upstream/main' into kivymd
Silvris Jun 2, 2024
3672fd1
slight launcher cleanup, still work to do there
Silvris Jun 2, 2024
9a979ba
load theme through kv, finally get images in icons
Silvris Jun 4, 2024
da20175
Merge remote-tracking branch 'upstream/main' into kivymd
Silvris Jul 5, 2024
6cb0cbe
test
Silvris Jul 5, 2024
367a6e8
test 2
Silvris Jul 5, 2024
7db16f0
found the problem
Silvris Jul 5, 2024
84e5ca6
fix launcher from merge
Silvris Jul 5, 2024
3a7e576
Merge remote-tracking branch 'upstream/main' into kivymd
Silvris Aug 25, 2024
b5e7d13
tooltips
Silvris Aug 25, 2024
224fa63
cleanup
Silvris Aug 25, 2024
35e580a
fix launcher background, remove unnecessary
Silvris Aug 26, 2024
de25172
Merge remote-tracking branch 'upstream/main' into kivymd
Silvris Sep 5, 2024
fb52ffa
launcher overhaul
Silvris Sep 6, 2024
dc29685
Merge remote-tracking branch 'upstream/main' into kivymd
Silvris Sep 9, 2024
7a0b346
Update Launcher.py
Silvris Sep 9, 2024
018df15
frozen build works, launcher shortcuts
Silvris Sep 12, 2024
2b11d57
lazy import to mask log message
Silvris Sep 12, 2024
49e426e
ladx client
Silvris Sep 12, 2024
83abe78
hopefully Wargroove
Silvris Sep 12, 2024
2643f9e
fix button issue
Silvris Sep 12, 2024
1c793ae
reimplement almost all of toggle button
Silvris Sep 12, 2024
398eb5c
huh kivy did the work for me
Silvris Sep 12, 2024
ded7c38
Update kvui.py
Silvris Sep 13, 2024
51cacde
revert WG changes other than tabs
Silvris Sep 13, 2024
3778ee7
sc2
Silvris Sep 13, 2024
ef10d91
common client cleanup
Silvris Sep 13, 2024
a7fe259
actually make launcher reflect color
Silvris Sep 13, 2024
238be83
lmao
Silvris Sep 13, 2024
fd022fb
unused bits, align EL
Silvris Sep 13, 2024
77f12e3
Merge remote-tracking branch 'upstream/main' into kivymd
Silvris Sep 13, 2024
3e47542
trim docstring
Silvris Sep 14, 2024
7437924
text and message coloring
Silvris Sep 14, 2024
4869573
add remove tab helper function
Silvris Sep 19, 2024
896a0bb
update size on add_widget for clienttabs
Silvris Sep 19, 2024
6b5f2c0
remove add_widget override
Silvris Sep 19, 2024
3bddf39
Merge remote-tracking branch 'upstream/main' into kivymd
Silvris Sep 27, 2024
9c285a0
Update kvui.py
Silvris Sep 28, 2024
05aead3
pin kivymd
Silvris Nov 28, 2024
5d362b0
Merge remote-tracking branch 'upstream/main' into kivymd
Silvris Nov 28, 2024
795d55c
init work for popup
Silvris Nov 28, 2024
70a5035
Update Launcher.py
Silvris Nov 28, 2024
137559c
cleanup
Silvris Nov 28, 2024
d8da0ee
Update Launcher.py
Silvris Nov 28, 2024
ca16184
remove fix_heights for good
Silvris Nov 28, 2024
5b04955
re-enable content scroll
Silvris Nov 28, 2024
c9c6128
Merge remote-tracking branch 'upstream/main' into kivymd
Silvris Nov 28, 2024
48d7d70
Merge remote-tracking branch 'upstream/main' into kivymd
Silvris Dec 5, 2024
d8b49fc
Update kvui.py
Silvris Dec 5, 2024
9e6e194
revert fix_heights removal for now
Silvris Dec 5, 2024
039af0f
broken lol
Silvris Dec 5, 2024
4d11f13
proper fix_heights fix
Silvris Dec 5, 2024
7faab2e
Merge branch 'main' into kivymd
Silvris Dec 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'upstream/main' into kivymd
Silvris committed Dec 5, 2024
commit 48d7d7033d8dd77219776d432c2f65a3164eb888
30 changes: 6 additions & 24 deletions Launcher.py
Original file line number Diff line number Diff line change
@@ -127,31 +127,13 @@ def handle_uri(path: str, launch_args: Tuple[str, ...]) -> None:
elif component.display_name == "Text Client":
text_client_component = component

from kvui import MDApp, MDButton, MDButtonText, Clock, Window
from kvui import MDButton, MDButtonText
from kivymd.uix.dialog import MDDialog, MDDialogHeadlineText, MDDialogContentContainer, MDDialogSupportingText
from kivymd.uix.divider import MDDivider

if not client_component:
popup_text = MDDialogSupportingText(text=f"A game client able to parse URIs was not detected for {game}.\n"
f"Launching Text Client in 7 seconds...")
popup_text.remaining_time = 7

def update_label(dt):
if popup_text.remaining_time > 1:
# countdown the timer and string replace the number
popup_text.remaining_time -= 1
popup_text.text = f"A game client able to parse URIs was not detected for {game}.\n"\
f"Launching Text Client in {popup_text.remaining_time} seconds..."
else:
# our timer is finished so launch text client and close down
run_component(text_client_component, *launch_args)
Clock.unschedule(update_label)
MDApp.get_running_app().stop()
Window.close()

Clock.schedule_interval(update_label, 1)

component_buttons = []
if client_component is None:
run_component(text_client_component, *launch_args)
return
else:
popup_text = MDDialogSupportingText(text="Select client to open and connect with.")
component_buttons = [MDDivider()]
@@ -245,7 +227,7 @@ def create_shortcut(button, component: Component):

def run_gui(path: str, args: Any):
from kvui import (MDApp, MDFloatLayout, MDGridLayout, MDButton, MDLabel, MDButtonText, MDButtonIcon, ScrollBox,
ContainerLayout, Widget, MDBoxLayout)
ContainerLayout, Widget, MDBoxLayout, ApAsyncImage)
from kivy.core.window import Window
from kivy.metrics import dp
from kivy.uix.image import AsyncImage
@@ -298,7 +280,7 @@ def build_card(component: Component) -> Widget:
button_card.add_widget(button_layout)

source = icon_paths[component.icon]
image = AsyncImage(source=source, size=(40, 40), size_hint_y=None,
image = ApAsyncImage(source=source, size=(40, 40), size_hint_y=None,
pos_hint={"center_x": 0.1, "center_y": 0.5})

button_layout.add_widget(image)
33 changes: 24 additions & 9 deletions kvui.py
Original file line number Diff line number Diff line change
@@ -53,6 +53,7 @@
from kivy.uix.recycleview.layout import LayoutSelectionBehavior
from kivy.animation import Animation
from kivy.uix.popup import Popup
from kivy.uix.image import AsyncImage
from kivymd.app import MDApp
from kivymd.uix.gridlayout import MDGridLayout
from kivymd.uix.floatlayout import MDFloatLayout
@@ -388,7 +389,7 @@ def __init__(self):
child.bind(texture_size=self.set_height)


ctx = App.get_running_app().ctx
ctx = MDApp.get_running_app().ctx
self.dropdown = DropDown()

def set_value(button):
@@ -419,7 +420,8 @@ def refresh_view_attrs(self, rv, index, data):
self.finding_text = data["finding"]["text"]
self.location_text = data["location"]["text"]
self.entrance_text = data["entrance"]["text"]
self.found_text = data["found"]["text"]
self.status_text = data["status"]["text"]
self.hint = data["status"]["hint"]
return super(HintLabel, self).refresh_view_attrs(rv, index, data)

def refresh_view_layout(self, rv, index, layout, viewport):
@@ -436,7 +438,7 @@ def on_touch_down(self, touch):
if status_label.collide_point(*touch.pos):
if self.hint["status"] == HintStatus.HINT_FOUND:
return
ctx = App.get_running_app().ctx
ctx = MDApp.get_running_app().ctx
if ctx.slot == self.hint["receiving_player"]: # If this player owns this hint
# open a dropdown
self.dropdown.open(self.ids["status"])
@@ -469,11 +471,7 @@ def on_touch_down(self, touch):
else:
parent.sort_key = key
parent.reversed = False
break
else:
logging.warning("Did not find clicked header for sorting.")

MDApp.get_running_app().update_hints()
MDApp.get_running_app().update_hints()

def apply_selection(self, rv, index, is_selected):
""" Respond to the selection of items in the view. """
@@ -847,6 +845,23 @@ def clean_old(self):
self.data.pop(0)



status_names: typing.Dict[HintStatus, str] = {
HintStatus.HINT_FOUND: "Found",
HintStatus.HINT_UNSPECIFIED: "Unspecified",
HintStatus.HINT_NO_PRIORITY: "No Priority",
HintStatus.HINT_AVOID: "Avoid",
HintStatus.HINT_PRIORITY: "Priority",
}
status_colors: typing.Dict[HintStatus, str] = {
HintStatus.HINT_FOUND: "green",
HintStatus.HINT_UNSPECIFIED: "white",
HintStatus.HINT_NO_PRIORITY: "cyan",
HintStatus.HINT_AVOID: "salmon",
HintStatus.HINT_PRIORITY: "plum",
}


class HintLog(MDRecycleView):
header = {
"receiving": {"text": "[u]Receiving Player[/u]"},
@@ -871,7 +886,7 @@ def refresh_hints(self, hints):
if not hints: # Fix the scrolling looking visually wrong in some edge cases
self.scroll_y = 1.0
data = []
ctx = App.get_running_app().ctx
ctx = MDApp.get_running_app().ctx
for hint in hints:
if not hint.get("status"): # Allows connecting to old servers
hint["status"] = HintStatus.HINT_FOUND if hint["found"] else HintStatus.HINT_UNSPECIFIED
You are viewing a condensed version of this merge commit. You can view the full changes here.