Code Monkey home page Code Monkey logo

Comments (7)

goblinfactory avatar goblinfactory commented on May 24, 2024

I did a whole refactoring to supporting styling and lists, and got stuck on a bug, and never maanged to release the update. Tables is part of that update, I show cased tables in our gitter chat, ...you can do stuff like this easily;
Screen Shot 2020-06-03 at 09 11 06

see the discussion in gitter here: https://gitter.im/goblinfactory-konsole/community

I have been consumed with another project and since the conversation in gitter didn't get any attention konsole has been on my backlog of nice to fix, but not urgent.

I have one small bug I need some volunteers to help me iron out, then I have a massive update for konsole that will include list controls, with highlighted current item, with hooks for OnItemSelected, as well as inline form editing. I need the big styling refactoring since to get editing to work smoothly I need to be able to re-render a control with .active styling and .inactive styling when tabbing away. Windows need to be selectable as well (double line in color X when selected and single line when inactive etc).

A lot of work has gone into preparing for that, ...tables was done first. The same above uses a control DirectoryListView that implements ListView ...which is ...the table view you're asking for.

you can see table view in this branch, and you can use the code easily now with current Konsole if you want;

https://github.com/goblinfactory/konsole/tree/feature/list-view

from konsole.

goblinfactory avatar goblinfactory commented on May 24, 2024

code for the above screen, with the branch mentioned above, using custom business rules to style directories and large files differently based on business rules is just this

public static void Main(string[] args)
        {
            var window = new Window();
            var console = window.SplitLeft("left");
            var right = window.SplitRight("right");
            var listView = new DirectoryListView(console, "../../..");

            // let's highlight - all files > 4 Mb and make directories green
            listView.BusinessRuleColors = (o, column) =>
            {
                if (column == 2 && o.Size > 4000000) return new Colors(White, DarkBlue);
                if (column == 1 && o.Item is DirectoryInfo) return new Colors(Green, Black);
                return null;
            };

            listView.Refresh();


            Console.ReadKey(true);
        }

from konsole.

goblinfactory avatar goblinfactory commented on May 24, 2024

your business rule can easily be ... if o.Selected == true to easily support highlighting current item.

from konsole.

goblinfactory avatar goblinfactory commented on May 24, 2024

here's how to use the raw ListView object to draw tables

            var window = Window.OpenBox("openings", 50, sy, 35, 12, style);
           var moves = new[] {
                    ("Kings Gambit", 39, "win"),
                    ("Sicilian Defence", 35, "draw"),
                    ("French Defence", 22, "win"),
                    ("Alekhine Defence", 19, "win"),
                    ("Kings Gambit", 33, "win"),
                    ("Kings Indian", 21, "draw"),
                    ("Ruy Lopaz", 82, "lose")  };
            var view = new ListView<(string opening, int moves, string result)>( window,
                     _ => moves, (u) => new[] {
                        u.opening,
                        u.moves.ToString(),
                        u.result,
                    },
                new Column("Opening", 0),
                new Column("Moves", 7),
                new Column("Result", 7)
            );	            );
            view.Refresh();	            view.Refresh();

from konsole.

goblinfactory avatar goblinfactory commented on May 24, 2024

I am also working konsole Table that automatically prints any collection as a table, var table = new Table(window); table.Print(myUserCollection) or if you're not using a parent window, new Table(users).Print() for the simplest use.

from konsole.

goblinfactory avatar goblinfactory commented on May 24, 2024

@DkAngelito just finished branch with ListView in it, ready for merging to master for testing.
https://github.com/goblinfactory/konsole/tree/feature/list-view-themes-no-tuples-docmd
Just need to update documentation and will release new version next few days.

from konsole.

goblinfactory avatar goblinfactory commented on May 24, 2024

Here's my test for the listview theming, almost all done, next I need to write the updates to the documentation then create new package for testing

themed-dirlist

from konsole.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.