Gerold55 / laptop

Introducing the MineTest Laptop Mod
Other
26 stars 14 forks source link

app-request: Browser #67

Closed Gerold55 closed 5 years ago

Gerold55 commented 6 years ago

The browser is where you have different icons for different help pages. First one would be for the "wiki" for the laptop mod.

bell07 commented 6 years ago

Is there a difference to #48 ? If not, can we close this issue?

Gerold55 commented 6 years ago

This is sort of like an internet browser.

Gerold55 commented 6 years ago

@bell07 @Grizzly-Adam could we start working on this after themes are done?

Grizzly-Adam commented 6 years ago

So what are we looking at, building our own internet?

On Wed, Mar 21, 2018 at 3:35 PM, Gerold55 notifications@github.com wrote:

@bell07 https://github.com/bell07 @Grizzly-Adam https://github.com/grizzly-adam could we start working on this after themes is done?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Gerold55/minetest-laptop/issues/67#issuecomment-375086799, or mute the thread https://github.com/notifications/unsubscribe-auth/AhktCWupurjwtHMF5Txb-3XwDjbJ8Ti_ks5tgrmpgaJpZM4RI9qK .

Gerold55 commented 6 years ago

Sort of. It should sorta be text-based probably. We should have a wiki and some other things in it. Not really a full-fledged internet browser like google.

bell07 commented 6 years ago

Agre to Grizzly-Adam. The issue is the content to fill the own internet. Somehow needs to write the wiki content and the content of "some other things" at the first.

The ingame authoring is bad idea because we can store data for each world only, So each singleplayer/each server/each world starts with empty WWW.

THe other issue is the formspec limitations. The "Stickynote pad" is nearly the maximum posiible for ingame authoring. :-(

Gerold55 commented 6 years ago

Well for the web browser it would be more of text base and we can set it up to have the ability to make the pages outside of the game in the code/mod. We can also have our own site names. The main page could be a welcome page possibly. On Mar 21, 2018 5:41 PM, "bell07" notifications@github.com wrote:

Agre to Grizzly-Adam. The issue is the content to fill the own internet. Somehow needs to write the wiki content and the content of "some other things" at the first.

THe ingame writing is bad idea because we can store data for each world only, So each singleplayer/each server/each world starts with empty WWW.

THe other issue is the formspec limitations. The "Stickynote pad" is nearly the maximum posiible for ingame authoring. :-(

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Gerold55/minetest-laptop/issues/67#issuecomment-375105497, or mute the thread https://github.com/notifications/unsubscribe-auth/ANM6lxz6xzHqFZPQdVyDyENffPdHRfeNks5tgskWgaJpZM4RI9qK .

Gerold55 commented 6 years ago

So it won't access the real internet but our own made up one.

bell07 commented 6 years ago

I like to move the "Ingame documentation" discussion to this thread. The browser could be used for ingame documentation too. (visiting CS-BOS homepage?)

Draft prototype / tech demo exists in my docu_app branch branch. Simple app that reads text file from mod directory.

Gerold55 commented 6 years ago

Sounds good to me 👍 On Mar 21, 2018 5:52 PM, "bell07" notifications@github.com wrote:

I like to move the "Ingame documentation" discussion to this thread. The browser could be used for ingame documentation too. (visiting CS-BOS homepage?)

Draft prototype / tech demo exists in my docu_app branch https://github.com/bell07/minetest-laptop/tree/docu_app branch. Simple app that reads text file from mod directory.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Gerold55/minetest-laptop/issues/67#issuecomment-375108327, or mute the thread https://github.com/notifications/unsubscribe-auth/ANM6l8IG8DPZX54y_1pIqzgsMMJbrgM5ks5tgsu1gaJpZM4RI9qK .

Grizzly-Adam commented 6 years ago

@bell07 How do we plan to support links? I think the web needs to be done primarily in addons-- in a method easy for the average Joe to do. We put our documentation in the main build, and everything else in addons to keep the size small and the internet modular. Added bonus-- it will be more like the real internet if we can get people to write their own sites.

I could include a website in my BBQ mod for instance that talks about BBQ and tells about the grills, etc.

bell07 commented 6 years ago

Links, hm, no idea. At the end the very basic version is a "text file viewer" with some navigation buttons. How the navigation buttons should be defined is unclear at the time.

The handling is more like the skins at the time: Server owner puts texts (www-pages) files to an folder, the player can look for.

That is my idea. I see a lot of work for to get small ingame value, so I am not motivated to write it.

I could include a website in my BBQ mod for instance that talks about BBQ and tells about the grills, etc.

The right way for ingame documentation is to write factoids for wuzzy's doc system. Because it is usable for people without laptop too. https://forum.minetest.net/viewtopic.php?t=15912

Maybe the browser can show the help, but small ingame value only, because the player can allways look to the documentation from player inventory.

Gerold55 commented 6 years ago

Well, I think it should be available both ways. The browser would have "text files" but you can type some made up site and the site would be defined in some way or another. The individual can add more sites to the laptop mod. Also, we can use it for servers like Persistent Kingdoms and each time can see who's on the team and what's going on.

bell07 commented 6 years ago

Well, I think it should be available both ways. The browser would have "text files" but you can type some made up site and the site would be defined in some way or another. The individual can add more sites to the laptop mod.

At the first we need to differentiate the "text files" (Sticky note app) and "text files" (Real life *.txt files on server). My proposal is to support the second at the first.

The stickynote supports HDD and FDD storage at the time only. As I implemented it I decided not to use the cloud. Using cloud it could be possible to store documents to "private storage cloud (accessable by user)", public storage cloud (accessably by all players) and if "Teams" are implemented, the team storage cloud). I decided not to use it because then tere is no reason anymore to store anything on HDD or removeable.

Maybe we find an way to "upload" stickynote text files to the WWW. But this should not be easy as the "save as".

Also, we can use it for servers like Persistent Kingdoms and each time can see who's on the team and what's going on.

Team support is missed complelty, requested in #116 Maybe the mail app can support the teams at the first to inform all members what's going on

Gerold55 commented 6 years ago

@bell07 how would I start to work on this? I'm wanting to create individual formspecs for each website.

bell07 commented 6 years ago

The best way you write an own app each website at the first. using laptop.register_app() The app names could be something like "www.xyz.org" Second step you can implement an "overview" app that contains links to the web-pages using buttons. The navigation can be done in receive_fields_func using mtos:set_app(appname) If this is working, you can change register_app to register_view - technically the same but not in launcher

bell07 commented 6 years ago

Pls. do not merge your changes directly to master. Pls. create a new branch "browser_app" for this. Usually only reviewed and well-tested changes should be merged to master. All in progress-changes should be in own branch

Gerold55 commented 6 years ago

Here's what I have so far. screenshot 368

Gerold55 commented 6 years ago

Am not too sure what to do from here @bell07

bell07 commented 6 years ago

You need a formspec at the next

    app_info = "Web Browser",
    formspec_func = function(app, mtos)
        local formspec = mtos.theme:get_label('0,0', 'Hello World')
        return formspec
    end,
bell07 commented 6 years ago

You can just concatenate the formspec strings as in other mods, but if a theme method exists, please use the method because of automatically theme applied

Gerold55 commented 6 years ago

I'm gonna figure it out hopefully I can lol

Gerold55 commented 6 years ago

@bell07 how would I create a search bar? I can't find that anywhere.

Gerold55 commented 6 years ago

So I've got a text field just need a little help with getting it to function.

Gerold55 commented 6 years ago

screenshot 369

bell07 commented 6 years ago

The next step is to add the

    receive_fields_func = function(app, mtos, sender, fields)

    end, 

The fields table contains your input and pressed buttons, based on definition in formspec_func. Can you please copy@paste your current code? (in code-tags, no screenshot)

if you start minetest from console you can check the content adding temporary the print(dump(fields))) into the function

Gerold55 commented 6 years ago

` laptop.register_app("browser", {

app_name = "MineBrowse",
app_icon = "laptop_removable.png",
app_info = "Web Browser",
formspec_func = function(app, mtos)
    local formspec = 
            "field[.2,.5;13,1;name; ;]"..
            "image_button[12.9,.3;.8,.8;laptop_theme_basic_button.png;name;]"..
            "image_button[13.6,.3;.8,.8;laptop_theme_basic_button.png;name;]"..
            "image_button[14.3,.3;.8,.8;laptop_theme_basic_button.png;name;]"..
            ']'
    return formspec
end,

})`

bell07 commented 6 years ago
  1. ok, you need different "name"'s at the first. So you can access them using fields.name in receive_fields_func.
  2. For buttons they are themed methods get_button() and get_image_button()
  3. the laset ']' is not needed

Untested:

    formspec_func = function(app, mtos)
        local formspec = 
            "field[.2,.5;13,1;input_field; ;]field_close_on_enter[input_field;false]"..
            mtos.theme:get_image_button('12.9,.3;.8,.8', 'minor', 'xxx_button', 'laptop_theme_basic_button.png', '', 'XXX Tooltipp')
        return formspec
    end,
    receive_fields_func = function(app, mtos, sender, fields)
        if fields.key_enter then
            print("Enter pressed, the Input field contains "..fields.input_field)
        elseif fields.xxx_button then
            print("XXX Button pressed")
        end
    end, 

You can also look to other apps how anything is done

Gerold55 commented 6 years ago

So how would I add 2 additional buttons to it? Also, I'm wanting it to switch by looking for the website URL. So when you type it in it'll take you to that address. Also when you open it up it should automatically be opened to the main webpage.

Gerold55 commented 6 years ago

@bell07 I'm sry not used to making something like this so that's why I'm asking so many questions.

bell07 commented 6 years ago

The questions how to do anything technically are ok. My issue is I do not see the concept or vision how it should be.

Unsure if my proposal above is the right way, to use "App-View" for each page, or it is beter to write anything more generic and store the "Web-Content" in own text files.

But back to your question: Please create at the first the complete first page, without functionality, just visual. If this is done, we can look how is the best way to get it working.

To your question: You can add additional buttons like manual concatenations:

            "field[.2,.5;13,1;input_field; ;]field_close_on_enter[input_field;false]"..
            mtos.theme:get_image_button('12.9,.3;.8,.8', 'minor', 'xxx_button', 'laptop_theme_basic_button.png', '', 'XXX Tooltipp') ..
            mtos.theme:get_image_button(second button parameter) ..
            mtos.theme:get_image_button(third button parameter) ..
            "anyother[formspec]parameter[s]" ..
            mtos.theme:get_label(label parameters)

Look to other apps for "tipps and tricks" ;-)

Gerold55 commented 6 years ago

screenshot 373 screenshot 374

Gerold55 commented 6 years ago

screenshot 378

Here's what I have so far. Needs some further kinking out but this is the basis of the welcome page. Let me know if you have any further ideas for it.

Gerold55 commented 6 years ago

browser_app.zip

Gerold55 commented 6 years ago

@bell07

Gerold55 commented 6 years ago

Hopefully we can get it working. So I've added a few additional things to the app which differs from the app I linked above.

bell07 commented 6 years ago

Sorry, but I am not 24h at computer.

I created a new branch for you and uploaded your file to the browser_app branch.

Please do all browser app related work to this branch. This way it is possible just to merge all changes to master using pull request, if all is done.

Tested shortly. The Images laptop_welcome_web.png and laptop_background_web.png are missed. Please upload the images to the mentioned branch. If you have updated the lua file in the meantime, so please update it in branch too.

Do you need any help from my site?

Gerold55 commented 6 years ago

I need help getting the buttons to work so it can switch between websites when typed in (URL). I was hoping you could possibly help with that. @bell07

bell07 commented 6 years ago

I have some time in ~4 h. If you did some changes in the meantime, please update the branch.. The links should be buttons, we need new prefix „url“ so the buttons looks like link text. I can do the template in default theme, but all themes needs to be enhanced for new prefix...

Gerold55 commented 6 years ago

Is there a way to detect a website that has been added and it'll create a link or something? I'm also wanting to add an area where it'll have a list of websites that are appropriate.

bell07 commented 6 years ago

I started some framework working. My current concept is each Website is just an App-View, not shown in launcher. A list of websites is possible, like the main launcher lists all "Normal" apps. Unfortunatelly it is not possible to "Submit a Website". Each Website needs to be registered from installed mod.

Gerold55 commented 6 years ago

The submit a website button will take them to submit.official page where they can submit a website by visiting the site listed on their rl browser.

On May 25, 2018 4:01 PM, "bell07" notifications@github.com wrote:

I started some framework working. My current concept is each Website is just an App-View, not shown in launcher. A list of websites is possible, like the main launcher lists all "Normal" apps. Unfortunatelly it is not possible to "Submit a Website". Each Website needs to be registered from installed mod.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Gerold55/minetest-laptop/issues/67#issuecomment-392164933, or mute the thread https://github.com/notifications/unsubscribe-auth/ANM6l-s1kp5zUJqkVXpLdQMvAlp81EmWks5t2GMrgaJpZM4RI9qK .

bell07 commented 6 years ago

I uploaded updated version now to the branch. Please note, the "themes.lua" is updated too, so pls update your local working copy with both files (or checkout full copy, or use git ;-))

The app does have is a working navigation, the pages list and some dummy pages. So feel free to fill the pages with content.

The themes.lua contains new default settings:

        -- used in browser app
        url_dark_textcolor = "#6495ED",
        url_dark_button = "laptop_theme_desktop_icon_label_button_black.png",
        url_bright_textcolor = "#000080",
        url_bright_button = "laptop_fruit_base.png",

New links could be url_dark or url_bright (depending on background) for now mtos.theme:get_button('x,y', 'url_dark', 'page_link', 'link.to.page')

bell07 commented 6 years ago

Updated API documentation and set min_version to value the old CS_BOS computers cannot execute this app

The submit a website button will take them to submit.official page where they can submit a website by visiting the site listed on their rl browser.

Realized. There is a submit.official scaffold in file you can fill with informations about RL-pages and how to contrubute

Gerold55 commented 6 years ago

Also is there a way to make it so when you open up the browser it shows the URL of the page that you're on which is welcome.official.

Gerold55 commented 6 years ago

browser_app.zip Here's the new app with my small updates because idk if you have edited the code again.

bell07 commented 6 years ago

THe "Homepage" is the "browser" app. So we can remove the "welcome.official"? Or do you like to rename "browser" to "welcome.official"? Maybe I need to do additional changes to be more clear ("browser://welcome.official"). But not now, I go sleep

Gerold55 commented 6 years ago

Yeah we can remove welcome.official since the page that you open up on is the welcome.official page On May 25, 2018 6:22 PM, "bell07" notifications@github.com wrote:

THe "Homepage" is the "browser" app. So we can remove the "welcome.official"? Or do you like to rename "browser" to "welcome.official"? Maybe I need to do additional changes to be more clear ("browser://welcome.official"). But not now, I go sleep

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Gerold55/minetest-laptop/issues/67#issuecomment-392202554, or mute the thread https://github.com/notifications/unsubscribe-auth/ANM6lwD9uipjQQexCZYWNmW_0APoawCvks5t2IRBgaJpZM4RI9qK .

bell07 commented 6 years ago

About your change: mtos.theme:get_image_button('12.9,.3;.8,.8', 'minor', 'go_button', 'laptop_theme_basic_button.png^laptop_go_web.png', '', 'Go') ..

"minor" contains already "laptop_theme_minor_button.png" that you override by both other textures. The "minor" is not the right settings prefix. I think we need a new prefix "toolbar" ? Just replace minor by toolbar and add toolbar_textcolor = #RGBCOLOR and toolbar_button= "laptop_theme_basic_button.png" settings to the defaults in themes.lua

Gerold55 commented 6 years ago

Could we make it possible to be able to load websites from different files. So people can create their own website and then put it into a website folder and the browser will pick it up?