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

library: Adds columnview entry #437

Merged
merged 13 commits into from Aug 7, 2023
Merged

library: Adds columnview entry #437

merged 13 commits into from Aug 7, 2023

Conversation

SoNiC-HeRE
Copy link
Contributor

No description provided.

@SoNiC-HeRE SoNiC-HeRE marked this pull request as draft July 20, 2023 18:11
@SoNiC-HeRE
Copy link
Contributor Author

SoNiC-HeRE commented Jul 22, 2023

I've implemented the following:

  • Implemented Column View
  • Used DirectoryList Model
  • Added 3 Columns
  • Currently displays the directories and their respective sizes

P.S:

  • For the 3rd column i was trying to update the label with date created; however when i try to implement it; a default value for the date gets shown instead of actual value; so I've kept it void for now
  • Also I'm not sure how do i display the current selected column since it's a File Model and we can't just simply use get_string property for Gtk.StringModel

What else can be demonstrated here? @andyholmes

Copy link
Contributor

@andyholmes andyholmes left a comment

Choose a reason for hiding this comment

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

This is starting to shape up.

Let's get the UI a little more polished, because we still need to demonstrate column sorters, resizing, and probably want to do column that has a different type like an icon.

src/Library/demos/Column View/main.json Outdated Show resolved Hide resolved
src/Library/demos/Column View/main.blp Show resolved Hide resolved
src/Library/demos/Column View/main.js Outdated Show resolved Hide resolved
src/Library/demos/Column View/main.js Outdated Show resolved Hide resolved
src/Library/demos/Column View/main.js Outdated Show resolved Hide resolved
src/Library/demos/Column View/main.js Outdated Show resolved Hide resolved
Copy link
Contributor

@andyholmes andyholmes left a comment

Choose a reason for hiding this comment

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

Cool, once the date column is reporting a basic date, it's on to the "fun" part: column sorting.

Do you want to work through column sorting together, or if I link you to Gtk.ColumnView.get_sorter() as a hint do you can get the name column sorting?

src/Library/demos/Column View/main.js Outdated Show resolved Hide resolved
src/Library/demos/Column View/main.js Outdated Show resolved Hide resolved
factory.connect("bind", (factory, list_item) => {
const label_widget = list_item.get_child();
const model_item = list_item.get_item();
label_widget.label = model_item.get_size().toString();
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably we want to use a human readable size here, but let's leave that for the polish phase.

Copy link
Contributor

Choose a reason for hiding this comment

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

Be sure to double-check my math, but this should be good enough:

if (Math.floor(size / 1_000_000_000) > 0)
  label_widget.label = `${(size / 1_000_000_000).toFixed(1)} GB`
else if (Math.floor(size / 1_000_000) > 0)
  label_widget.label = `${(size / 1_000_000).toFixed(1)} MB`
else if (Math.floor(size / 1000) > 0)
  label_widget.label = `${(size / 1000).toFixed(1)} kB`
else
  label_widget.label = `${(size / 1000)} bytes`

src/Library/demos/Column View/main.blp Outdated Show resolved Hide resolved
Copy link
Contributor

@andyholmes andyholmes left a comment

Choose a reason for hiding this comment

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

Nice job!

This is tough one, and it's going to help a lot of people. Let's get the thing polished up, and it's good to merge.

src/Library/demos/Column View/main.js Outdated Show resolved Hide resolved
src/Library/demos/Column View/main.js Outdated Show resolved Hide resolved
src/Library/demos/Column View/main.js Show resolved Hide resolved
src/Library/demos/Column View/main.js Outdated Show resolved Hide resolved
src/Library/demos/Column View/main.js Outdated Show resolved Hide resolved
factory.connect("bind", (factory, list_item) => {
const label_widget = list_item.get_child();
const model_item = list_item.get_item();
label_widget.label = model_item.get_size().toString();
Copy link
Contributor

Choose a reason for hiding this comment

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

Be sure to double-check my math, but this should be good enough:

if (Math.floor(size / 1_000_000_000) > 0)
  label_widget.label = `${(size / 1_000_000_000).toFixed(1)} GB`
else if (Math.floor(size / 1_000_000) > 0)
  label_widget.label = `${(size / 1_000_000).toFixed(1)} MB`
else if (Math.floor(size / 1000) > 0)
  label_widget.label = `${(size / 1000).toFixed(1)} kB`
else
  label_widget.label = `${(size / 1000)} bytes`

@SoNiC-HeRE SoNiC-HeRE marked this pull request as ready for review August 7, 2023 18:44
Copy link
Contributor

@andyholmes andyholmes left a comment

Choose a reason for hiding this comment

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

🎉

@andyholmes andyholmes merged commit f891377 into main Aug 7, 2023
@SoNiC-HeRE SoNiC-HeRE self-assigned this Aug 10, 2023
sonnyp pushed a commit to SoNiC-HeRE/Workbench that referenced this pull request Aug 13, 2023
* Add columnview

* test

* Update

* Clean Up and implement colview

* Refactoring and applied suggested changes

* Applied changes

* Progress

* Updated

* Update

* Update

* Reverse

* Applied Suggested Changes

* Minor Change
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.

None yet

2 participants