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

Implement Drag-n'-Drop support #19

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Riven-Spell
Copy link

@Riven-Spell Riven-Spell commented Feb 28, 2023

Resolves #18

This is probably on the hacky/bad side, due to my general lack of familiarity with Avalonia-- But, I'm happy to hear any and all feedback, even if it's "Start from scratch and do it this way". I'm here to learn and contribute.

@BIRD311
Copy link
Member

BIRD311 commented Feb 28, 2023

Did unfortunately not work for me on linux (tested i3 and openbox). Maybe you could test this again on you system. The linked issue mentions opening new lumper instanced for multiple files.

@Riven-Spell
Copy link
Author

Did unfortunately not work for me on linux (tested i3 and openbox). Maybe you could test this again on you system.

Works fine for me on Windows-- I've yet to try on my Linux install, but I'll get around to it after work today.

The linked issue mentions opening new lumper instanced for multiple files.

I can look into doing this.

@Riven-Spell
Copy link
Author

Riven-Spell commented Mar 12, 2023

I'll get around to it after work today.

Liar, liar, pants on fire!

Did unfortunately not work for me on linux (tested i3 and openbox). Maybe you could test this again on you system.

AvaloniaUI/Avalonia#6085 Appears to be a known issue. That's fine for now.

The linked issue mentions opening new lumper instanced for multiple files.

Trying to get this working, being a bit finnicky.

It works now. Just a little slow (perhaps the best option will be to delay open until after the new window is open so the user thinks something's happened)

@Riven-Spell Riven-Spell force-pushed the feat/drag-n-drop branch 3 times, most recently from ebf1a4c to 486cf53 Compare March 12, 2023 21:58
Copy link
Member

@tsa96 tsa96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation looks okay, works for me on Windows. We definitely need to show some indicator when stuff in loading but that's a separate thing and requires async refactor that BIRD is writing up an issue on now.

Then a few general housekeeping issues:

  • Your editor seems to have changed a bunch of line ending or something, meaning loads of lines of changes that shouldn't be there.
  • Your branch includes merge commits, which we don't allow. This is our fault really, we don't have good guidelines for this repo. I've been drafting some general contribution guidelines this afternoon that'll be on the organisation README in the future. In the meantime, here's a preview:
    • Keep your branch up-to-date by rebasing, not using merge commits. We consider merge commits to be a major detriment to the quality of a Git repo, and will always ask you to remove any merge commits in code review, even if this means force-pushing.
    • Keep your commits clean and simple, splitting all changes into separate commits.
    • Don’t push commits specifically for addressing issues in earlier commits, including those brought up in code review. Instead, make those commits then fixup them into the original commit using an interactive rebase. Again, we have no problem with force-pushes; so long as you make sensible local backups, we feel that rewriting history of non-master branches is a necessary evil to avoid merge commits. For a general guide on this workflow, see here.
    • Name your commits using conventional commits (no Gitmojis!). If in doubt, just check the rest of the history of the repo and copy that.

It's probably easiest to address these changes, then just reset --mixed and recommit everything.

src/Lumper.UI/Views/MainWindow.axaml.cs Outdated Show resolved Hide resolved
src/Lumper.UI/Views/MainWindow.axaml.cs Outdated Show resolved Hide resolved
src/Lumper.UI/Views/MainWindow.axaml.cs Outdated Show resolved Hide resolved
src/Lumper.UI/Views/MainWindow.axaml.cs Outdated Show resolved Hide resolved
@Riven-Spell Riven-Spell force-pushed the feat/drag-n-drop branch 4 times, most recently from 4d2bad1 to 1832b25 Compare March 13, 2023 20:35
@Riven-Spell Riven-Spell requested review from tsa96 and BIRD311 and removed request for tsa96 and BIRD311 March 13, 2023 20:35
@tsa96
Copy link
Member

tsa96 commented Mar 14, 2023

Looks good to me! @BIRD311 did you bring up the issue about the file location or whatever you were talking about yesterday?

src/Lumper.UI/App.axaml.cs Outdated Show resolved Hide resolved
src/Lumper.UI/App.axaml.cs Outdated Show resolved Hide resolved
src/Lumper.UI/ViewModels/MainWindowViewModel.IO.cs Outdated Show resolved Hide resolved
@@ -1,5 +1,6 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Input;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed

@@ -17,10 +18,12 @@ public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime
desktop)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just revert this file so the drag and drop commit only touches file it has to

@@ -163,7 +163,7 @@ private async Task LoadBsp(IStorageFile file)
if(!file.TryGetUri(out var path))
{
throw new Exception("Failed to get file path");

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, revert or move formatting stuff to a separate commit

@tsa96
Copy link
Member

tsa96 commented Jun 26, 2024

This could be picked up again once my PR is in, either by the original author if they're still around, or someone else. But I'd suggest just rewriting / copying stuff over rather than rebasing.

The DataContext shadowing stuff I don't understand, just use ReactiveWindow (might be doing this alrwsy on my PR, don't remember) and WhenActivated. And setting up the event handlers should be done in the view.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow opening BSP files by dragging over UI view
3 participants