Skip to content

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.

@SoNiC-HeRE SoNiC-HeRE requested a review from andyholmes August 3, 2023 14:05
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?

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`

@SoNiC-HeRE SoNiC-HeRE requested a review from andyholmes August 5, 2023 17:18
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.

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 requested a review from andyholmes August 7, 2023 18:44
@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.

3 participants