|
Post by alexfish on Apr 23, 2023 22:31:17 GMT 1
Hi All
over last few weeks been trying to sort notebook
getting warnings
(notebook:18223): Gdk-CRITICAL **: 22:24:28.690: gdk_window_get_scale_factor: assertion 'GDK_IS_WINDOW (window)' failed
(notebook:18223): Gdk-CRITICAL **: 22:24:28.690: gdk_window_get_scale_factor: assertion 'GDK_IS_WINDOW (window)' failed
(notebook:18223): Gdk-CRITICAL **: 22:24:28.690: gdk_window_get_scale_factor: assertion 'GDK_IS_WINDOW (window)' failed
(notebook:18223): Gdk-CRITICAL **: 22:24:28.690: gdk_window_get_scale_factor: assertion 'GDK_IS_WINDOW (window)' failed
(notebook:18223): Gdk-CRITICAL **: 22:24:28.690: gdk_window_get_scale_factor: assertion 'GDK_IS_WINDOW (window)' failed
(notebook:18223): Gdk-CRITICAL **: 22:24:28.690: gdk_window_get_scale_factor: assertion 'GDK_IS_WINDOW (window)' failed
i am on pi4
can any one test hug3
tried container ebox but get same warning
put it in scrolled win = no warn
example
INCLUDE hug35.bac FUNCTION NOTEBOOKC(STRING hug_title$, int hug_xsize, int hug_ysize) 'TODO DONE LOCAL scrolled, notebook, layer, dim, i, lab, which
notebook = gtk_notebook_new()
scrolled = gtk_scrolled_window_new(0, 0) gtk_scrolled_window_set_policy(scrolled, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC) gtk_container_add(scrolled, notebook) layer = gtk_fixed_new()
gtk_widget_show(layer)
lab = gtk_label_new(hug_title$) which = gtk_notebook_append_page(notebook, layer, lab) gtk_widget_show_all(notebook) g_signal_connect_data(notebook, "switch-page", hug_NOTEBOOK_hack, 0, 0, 0)
IF HUG_WIDGET_SHOW THEN gtk_widget_show_all(scrolled)
g_signal_connect_data(notebook, "switch-page", hug_NOTEBOOK_hack, 0, 0, 0) hug_widget_xsize(STR$(scrolled)) = hug_xsize hug_widget_ysize(STR$(scrolled)) = hug_ysize hug_widget_signal(STR$(scrolled)) = 5 hug_widget_s_widget(STR$(scrolled)) = notebook hug_widget_type$(STR$(scrolled)) = "notebook" hug_widget_attach(STR$(scrolled)) = layer hug_widget_nb_page$(STR$(notebook)) = STR$(layer)
WIDGET = scrolled
RETURN scrolled
END FUNCTION
HUGOPTIONS("NOSCALING")
REM HUGOPTIONS("CANVAS GL")
win = WINDOW("Goo Canvas", 500, 400)
note=NOTEBOOK("Tab 1 EDIT",500,400) ATTACH(win,note,0,0)
ed_1=EDIT(500,400) ATTACH(note,ed_1,0,0)
'ATTACH(note,canvas,0,0)
DISPLAY
the text function
'CATCH hug_widget=hug_widget_s_widget(STR$(hug_widget)) IF INSTR(hug_gui_properties.options$, "TABLE") THEN SPLIT hug_gui_properties.options$ BY " " TO opt$ SIZE dim FOR i = 0 TO dim - 1 IF INSTR(opt$[i], "TABLE") AND i+2 < dim THEN layer = gtk_table_new(VAL(opt$[i+2]), VAL(opt$[i+1]), 1) BREAK END IF NEXT ELSE layer = gtk_fixed_new() END IF gtk_widget_show(layer) lab = gtk_label_new(hug_text$) which = gtk_notebook_append_page(hug_widget, layer, lab) hug_widget_nb_page$(STR$(hug_widget)) = CONCAT$(hug_widget_nb_page$(STR$(hug_widget)), " ", STR$(layer)) gtk_notebook_set_current_page(hug_widget, which)
BR Alex
|
|
|
Post by alexfish on Apr 24, 2023 11:15:39 GMT 1
Hi All
Did a full dig on this note book
set hug3.5 fix NoteBook
could not find method of Adding widgets to a particular page hug style
so at present have done this
INCLUDE "hug35.bac" HUGOPTIONS("NOSCALING") '================================================================================= FUNCTION PAGE(NUMBER hug_widget, STRING hug_text$) LOCAL dim, i, layer, lab, buffer, lst, image LOCAL which TYPE int
SELECT hug_widget_type$(STR$(hug_widget))
CASE "notebook" 'CATCH hug_widget=hug_widget_s_widget(STR$(hug_widget)) IF INSTR(hug_gui_properties.options$, "TABLE") THEN SPLIT hug_gui_properties.options$ BY " " TO opt$ SIZE dim FOR i = 0 TO dim - 1 IF INSTR(opt$[i], "TABLE") AND i+2 < dim THEN layer = gtk_table_new(VAL(opt$[i+2]), VAL(opt$[i+1]), 1) BREAK END IF NEXT ELSE layer = gtk_fixed_new() END IF gtk_widget_show(layer) lab = gtk_label_new(hug_text$) which = gtk_notebook_append_page(hug_widget, layer, lab) hug_widget_nb_page$(STR$(hug_widget)) = \ CONCAT$(hug_widget_nb_page$(STR$(hug_widget)), " ", STR$(layer)) gtk_notebook_set_current_page(hug_widget, which) END SELECT RETURN layer END FUNCTION '================================================================================= SUB PAGESET(long hug_widget,hug_child,hug_xpos,hug_ypos,)
gtk_widget_set_size_request(hug_child, hug_widget_xsize(STR$(hug_child)), \ hug_widget_ysize(STR$(hug_child)) ) gtk_fixed_put(hug_widget, hug_child, INT(hug_xpos*HUG_FONT_SIZE_FACTOR*HUG_XFT_SIZE_FACTOR), \ INT(hug_ypos*HUG_FONT_SIZE_FACTOR*HUG_XFT_SIZE_FACTOR)) END SUB
'========================================
'=====MAIN ======================================================================= win = WINDOW("NoteBook", 1280, 600)
'Add Notbook ============================= NoteBook =NOTEBOOK("Page 1",550,450) ATTACH(win,NoteBook,0,0)
ed = EDIT(200,200) ATTACH(NoteBooked,0,0) TEXT(ed,"Wellcome to NOTEBOOK")
'Add PAGES ============================= page1 = PAGE(NoteBook,"Page 2") but= BUTTON("This",200,20) PAGESET(page1,but,50,50)
'============================== page2 = PAGE(NoteBook,"Page 2") but= BUTTON("This",200,20) PAGESET(page2,but,50,50)
'============================== DISPLAY '==============================
So Now good to go unless get reply on the NoteBook
Now having a look at SET but the above method gives direct reference to the page
TEXT(note,page) does not pass a reference .
+ can not find reference in ATTACH that will pin point the page Will put post in trouble BR Alex
|
|
|
Post by alexfish on Apr 24, 2023 12:03:49 GMT 1
Well Well Can Not Remember Since Time has passed Solution HEREand had had code it so removed some bits some bits Here We Go 'OPTION INTERNATIONAL TRUE REM .po/.mo files have 'charset=UTF-8', so either set UTF-8 on in LANG variable, or do this... 'SETENVIRON "OUTPUT_CHARSET", UTF-8 INCLUDE "hug.bac" HUGOPTIONS("BASEXFTDPI 78") HUGOPTIONS("FONT DejaVu Sans 12") MyForm = WINDOW("This is my form",749,561)
'@ set up notebook with three tabs 0 to 2 SetupTab=NOTEBOOK("Tab0",749,561) TEXT(SetupTab,"Tab1") TEXT(SetupTab,"Tab2") ATTACH(MyForm,SetupTab,0,0)
'@ set notebook to 0 SET(SetupTab,0)
HelloTxt=ENTRY("Hello",91,21) '@ attach notebook to TAB 0 ATTACH(SetupTab,HelloTxt,10,10)
'@ make a button use -1 to allow gtk to set the default size ButCmd1=BUTTON("But1",-1,-1) ATTACH(SetupTab,ButCmd1,10,60)
'@ switch to notebook page 1 SET(SetupTab,1) WorldTxt=ENTRY("World",91,21) ATTACH(SetupTab,WorldTxt,10,10)
'@ button with user set size ButCmd2=BUTTON("But2",70,21) ATTACH(SetupTab,ButCmd2,10,60)
'@ switch to notebook page 2 SET(SetupTab,2) HelloWorldTxt=ENTRY("Hello World",133,21) ATTACH(SetupTab,HelloWorldTxt,100,100)
'@ return to tab 0 SET(SetupTab,0)
'@ note for tabs to be activly active ensure the gtk widget are within the bounds ' of the notebook , else tabs may not respond , not allways but some times
DISPLAY works in Joes hug3 , but here get these warnings Does not work in hug3.5 Now looking further BR Alex
|
|
|
Post by bigbass on Apr 24, 2023 16:19:08 GMT 1
Hello Alex this may help worked in 2021 we need a pure stand alone example Notebook demo in gtk3 ported to bacon sourceforge.net/p/baconproto/wiki/Page2/scroll down a little to see it called tabs3-gtk3-proto.baclook at the gtk3 proto demo and port it to HUG should work fine without warnings or errors Joe
|
|
|
Post by alexfish on Apr 24, 2023 21:52:54 GMT 1
Hi Joe
Well, Peters method worked as per say TEXT 2 , but now faced with a problem , The errors
I have , as say looked at it in respect of proto approach
hence the method , and something which is missing a reference to the notebook pages
and hence my method , PAGES of a NOTEBOOK API NOTEBOOK PAGES
as already posted the new API HUG3.1
win = WINDOW("NoteBook", 1280, 600)
'Add Notbook ============================= NoteBook =NOTEBOOK("Page 1",550,450) ATTACH(win,NoteBook,0,0)
ed = EDIT(200,200) ATTACH(NoteBook,ed,0,0) TEXT(ed,"Wellcome to NOTEBOOK")
'Add PAGES ============================= page1 = PAGE(NoteBook,"Page 2") but= BUTTON("This",200,20) PAGESET(page1,but,50,50)
'============================== page2 = PAGE(NoteBook,"Page 2") but= BUTTON("This What",200,20) PAGESET(page2,but,50,50)
page3 = PAGE(NoteBook,"Page 2") but= BUTTON("This But",200,20) PAGESET(page3,but,50,50) '============================== DISPLAY '============================== and with that I can add & delete pages + add widgets to any page when the app is up + HIDE PAGE SHOW PAGE IE:: to what we normally see done in NOTEBOOKS
it has been 10 years since I posted a Howto , although SET & GET are in the DOCS that in it's self speaks volumes. BR Alex
|
|
|
Post by alexfish on Apr 24, 2023 22:39:26 GMT 1
New NoteBook hug3.5
INCLUDE "hug35.bac" HUGOPTIONS("NOSCALING") '================================================================================= FUNCTION PAGE(NUMBER hug_widget, STRING hug_text$) LOCAL dim, i, layer, lab, buffer, lst, image LOCAL which TYPE int
SELECT hug_widget_type$(STR$(hug_widget))
CASE "notebook" 'CATCH hug_widget=hug_widget_s_widget(STR$(hug_widget)) IF INSTR(hug_gui_properties.options$, "TABLE") THEN SPLIT hug_gui_properties.options$ BY " " TO opt$ SIZE dim FOR i = 0 TO dim - 1 IF INSTR(opt$[i], "TABLE") AND i+2 < dim THEN layer = gtk_table_new(VAL(opt$[i+2]), VAL(opt$[i+1]), 1) BREAK END IF NEXT ELSE layer = gtk_fixed_new() END IF gtk_widget_show(layer) lab = gtk_label_new(hug_text$) which = gtk_notebook_append_page(hug_widget, layer, lab) hug_widget_nb_page$(STR$(hug_widget)) = CONCAT$(hug_widget_nb_page$(STR$(hug_widget)), " ", STR$(layer)) gtk_notebook_set_current_page(hug_widget, which) END SELECT RETURN layer END FUNCTION '================================================================================= SUB PAGESET(long hug_widget,hug_child,hug_xpos,hug_ypos,)
gtk_widget_set_size_request(hug_child, hug_widget_xsize(STR$(hug_child)), \ hug_widget_ysize(STR$(hug_child)) ) gtk_fixed_put(hug_widget, hug_child, INT(hug_xpos*HUG_FONT_SIZE_FACTOR*HUG_XFT_SIZE_FACTOR), \ INT(hug_ypos*HUG_FONT_SIZE_FACTOR*HUG_XFT_SIZE_FACTOR)) END SUB LOCAL TOG SUB focus TOG = NOT(TOG) IF TOG THEN HIDE (page2) ELSE SHOW(page2)
END IF END SUB '========================================
'================================================================================= win = WINDOW("NoteBook", 1280, 600)
'Add Notbook ============================= NoteBook =NOTEBOOK("Page 1",550,450) ATTACH(win,NoteBook,0,0)
ed = EDIT(200,200) ATTACH(NoteBook,ed,0,0) TEXT(ed,"Wellcome to NOTEBOOK")
'Add PAGES ============================= page1 = PAGE(NoteBook,"Page 2") but1= BUTTON("This",200,20) PAGESET(page1,but1,50,50)
'============================== page2 = PAGE(NoteBook,"Page 3") but2= BUTTON("This What",200,20) PAGESET(page2,but2,50,50)
page3 = PAGE(NoteBook,"Page 4") but3= BUTTON("This But",200,20) PAGESET(page3,but3,50,50) CALLBACK(but3,focus)
'============================== DISPLAY '==============================
hug3.5 NOTEBOOK will be posted as updated, after testing
BR Alex
Tip of the day :: tabbing through pages on page press UP arrow Key then LEFT or RIGHT arrow keys
|
|
|
Post by alexfish on Apr 27, 2023 7:04:57 GMT 1
To Highlite the append page From the docs
gint gtk_notebook_append_page ( GtkNotebook* notebook, GtkWidget* child, GtkWidget* tab_label )
this bit
The index (starting from 0) of the appended page in the notebook, or -1 if function fails.
relative to current note book
in the function PAGE we return the layer. as a direct reference by name
rather than a 0,1,2,3,4 ,
but if can get the index working all is good , but , still get this gtk warning ? hence still looking
as pointed to by Peter, GTK SERVER
# GTK3 backend # LIB_NAME = libgtk-3.so, libgdk-3.so
FUNCTION_NAME = gtk_notebook_new, NONE, WIDGET, 0 FUNCTION_NAME = gtk_notebook_set_tab_pos, NONE, NONE, 2, WIDGET, INT FUNCTION_NAME = gtk_notebook_popup_enable, NONE, NONE, 1, WIDGET FUNCTION_NAME = gtk_notebook_popup_disable, NONE, NONE, 1, WIDGET FUNCTION_NAME = gtk_notebook_get_n_pages, NONE, INT, 1, WIDGET FUNCTION_NAME = gtk_notebook_get_nth_page, NONE, WIDGET, 2, WIDGET, INT FUNCTION_NAME = gtk_notebook_append_page, NONE, INT, 3, WIDGET, WIDGET, WIDGET FUNCTION_NAME = gtk_notebook_insert_page, NONE, INT, 4, WIDGET, WIDGET, WIDGET, INT FUNCTION_NAME = gtk_notebook_remove_page, NONE, NONE, 2, WIDGET, INT FUNCTION_NAME = gtk_notebook_get_current_page, NONE, INT, 1, WIDGET FUNCTION_NAME = gtk_notebook_get_menu_label, NONE, WIDGET, 2, WIDGET, WIDGET FUNCTION_NAME = gtk_notebook_set_page, NONE, NONE, 2, WIDGET, INT FUNCTION_NAME = gtk_notebook_set_current_page, NONE, NONE, 2, WIDGET, INT FUNCTION_NAME = gtk_notebook_set_tab_label_text, NONE, NONE, 3, WIDGET, WIDGET, STRING FUNCTION_NAME = gtk_notebook_set_scrollable, NONE, NONE, 2, WIDGET, INT FUNCTION_NAME = gtk_notebook_set_tab_reorderable, NONE, NONE, 3, WIDGET, WIDGET, BOOL
and in hug.bac
IMPORT "gtk_notebook_append_page(long,long,long)" FROM hug_Gtk$ TYPE int
tha hack bit Concats the bits and the sorted by
SUB hug_NOTEBOOK_hack(NUMBER hug_widget, NUMBER hug_pg, int hug_pnr) : REM INCLUDE
LOCAL size
SPLIT hug_widget_nb_page$(STR$(hug_widget)) BY " " TO id$ SIZE size hug_widget_attach(STR$(hug_widget)) = VAL(id$[hug_pnr])
END SUB
now the bug, and hence for some reason when attaching the widget one can not Resize if in a Scrolled window Yes, if in a EBOX then NO
something has changed in gtk3 (container wise) from 10 year ago, I think says he
BR Alex
over all changes
/* in hug section <keyword>PAGE</keyword> <keyword>PAGESET</keyword> <keyword>GRIDATTACH</keyword> */
|
|
|
Post by alexfish on Apr 28, 2023 18:59:21 GMT 1
Update , looking further RE GTK3 ver >= 3,10
TABLE = DEPRECATED
new function GRID
but will be Added in this form
GRID uses IE button boxes etc
the bits
INCLUDE hug35.bac
LOCAL GTK$ GTK$ = HUGLIB$("gtk") PRINT GTK$ IMPORT "gtk_grid_new" FROM GTK$ TYPE long
IMPORT "gtk_grid_attach(long,long,int,int,int,int)" FROM GTK$ TYPE long IMPORT "gtk_grid_attach_next_to(long,long,long,int,int,int)" FROM GTK$ TYPE void IMPORT "gtk_grid_get_baseline_row (long)" FROM GTK$ TYPE int IMPORT "gtk_grid_get_child_at(long,int,int)" FROM GTK$ TYPE int IMPORT "gtk_grid_get_column_homogeneous (long)" FROM GTK$ TYPE int IMPORT "gtk_grid_get_column_spacing(long)" FROM GTK$ TYPE int IMPORT "gtk_grid_get_row_baseline_position(long)" FROM GTK$ TYPE int IMPORT "gtk_grid_get_row_homogeneous(long)" FROM GTK$ TYPE int IMPORT "gtk_grid_get_row_spacing(long)" FROM GTK$ TYPE int IMPORT "gtk_grid_insert_column(long,int)" FROM GTK$ TYPE void IMPORT "gtk_grid_insert_next_to(long,long,int)" FROM GTK$ TYPE void IMPORT "gtk_grid_insert_row(long, int)" FROM GTK$ TYPE void IMPORT "gtk_grid_remove_column(long,int)" FROM GTK$ TYPE void IMPORT "gtk_grid_remove_row(long,int)" FROM GTK$ TYPE void IMPORT "gtk_grid_set_baseline_row (long,int)" FROM GTK$ TYPE void IMPORT "gtk_grid_set_column_homogeneous (long,int)" FROM GTK$ TYPE void IMPORT "gtk_grid_set_column_spacing(long,int)" FROM GTK$ TYPE void IMPORT "gtk_grid_set_row_baseline_position (long,int,long)" FROM GTK$ TYPE void IMPORT "gtk_grid_set_row_homogeneous(long,int)" FROM GTK$ TYPE void IMPORT "gtk_grid_set_row_spacing(long,int)" FROM GTK$ TYPE void
FUNCTION GRID (int hug_xsize, int hug_ysize)
LOCAL grid
grid = gtk_grid_new() gtk_grid_set_row_spacing(grid,3) gtk_grid_set_column_spacing(grid,3) IF HUG_WIDGET_SHOW THEN gtk_widget_show_all(grid)
hug_widget_xsize(STR$(grid)) = hug_xsize hug_widget_ysize(STR$(grid)) = hug_ysize
hug_widget_type$(STR$(grid)) = "grid"
WIDGET = grid
RETURN grid END FUNCTION
SUB GRIDATTACH(long hug_widget,long hug_child,int hug_column,int hug_row,int colums_wide,int rows_high)
gtk_grid_attach(hug_widget,hug_child,hug_column,hug_row,colums_wide,rows_high)
END SUB /* Methods attach attach_next_to get_baseline_row get_child_at get_column_homogeneous get_column_spacing get_row_baseline_position get_row_homogeneous get_row_spacing insert_column insert_next_to insert_row remove_column remove_row set_baseline_row set_column_homogeneous set_column_spacing set_row_baseline_position set_row_homogeneous set_row_spacing */
HOME$= GETENVIRON$("HOME")
win = WINDOW ("GRID",606,438) ButtonBox = GRID(600,30) ATTACH(win,ButtonBox, 3, 3)
but=BUTTON("test ",-1,-1) GRIDATTACH(ButtonBox,but,0,0,1,1)
but=BUTTON("test2 has a long title",-1,-1) GRIDATTACH(ButtonBox,but,1,0,1,1) ent=ENTRY(" This cods wallop",-1,-1) GRIDATTACH(ButtonBox,ent,2,0,1,1) ed = EDIT(600,400) ATTACH(win,ed,3,33) DISPLAY
Update to lib hopeful 30th April
GRID will show as KEY WORD gridattach NOT
BR Alex
|
|
|
Post by alexfish on Apr 28, 2023 20:17:59 GMT 1
And so it is done INCLUDE hug35.bac
HOME$= GETENVIRON$("HOME")
win = WINDOW ("Hug Grid",606,438) ButtonBox = GRID(600,30) ATTACH(win,ButtonBox, 3, 3)
but=BUTTON("test ",-1,-1) GRIDATTACH(ButtonBox,but,0,0,1,1)
but=BUTTON("test2 has a long title",-1,-1) GRIDATTACH(ButtonBox,but,1,0,1,1) ent=ENTRY("Entry Box",-1,-1) GRIDATTACH(ButtonBox,ent,2,0,1,1) ed = EDIT(600,400) ATTACH(win,ed,3,33) DISPLAY Makes for easy attachment of button types + no need to work out the position for each widget as in pixels ATTACH(win,ButtonBox, 3, 3) or the width Second Picky hug3 EDIT Attachments:
|
|
|
Post by alexfish on Apr 28, 2023 23:53:24 GMT 1
Testing those changes Containment of widgets hug V hug3 , since hug3 widget containment can be a problem Chalk & Cheese if that combo box is not contained then window will expand the window width so widgets need to be within the window bounds Picky Attachments:
|
|
|
Post by alexfish on Apr 29, 2023 11:56:39 GMT 1
Hi All Further debugging + added SETPAGE to the API '================================================================================= win = WINDOW("Chalk & Cheese", 806, 606)
'NOTEBOOK returns notebook no pages ===== NoteBook =NOTEBOOK("WebView ",800,600) ATTACH(win,NoteBook,3,3)
'add first page page1 = PAGE(NoteBook,"Web View")
ent = ENTRY("https://www.basic-converter.org/",400,-1) PAGESET(page1,ent,3,3)
but = BUTTON("L",-1,-1) PAGESET(page1,but,406,3)
web = WEBVIEW(780,540) PAGESET(page1,web,3,40) list = LIST(323,200)
LINKS(list,"https://www.basic-converter.org/",urls$) PAGESET(page1,list,457,3)
page2 = PAGE(NoteBook,"Downloads") ed = EDIT(600,500) PAGESET(page2,ed,3,40)
Load_Url(web,"https://www.basic-converter.org/")
SETPAGE(NoteBook, 0) '============================== DISPLAY '============================== For Web View: Added url parser to find links updated lib will be done Sunday evening BST BR Alex Attachments:
|
|
|
Post by alexfish on Apr 29, 2023 16:07:44 GMT 1
And So TO Yes again another bit of the tool-change HTML picky self descriptive : to complete this: requires that Parser + libsoup all = HugWebKit Q: what has this got to with hug imager A: Look at the Picky : can you see any Images hug imager is going to get them, process them & then hopeful of a Viola: I think says he Q: how do I Know that ain't fake A: the Picky shows a depressed button link Q: why libsoup A: only bit I know the will do a: youtube search and b: google search as starter for google managed to get the sign me up shit page just neeeeeed find out how to to send the shitty thing back See Second Picky BR Alex Attachments:
|
|
|
Post by alexfish on Apr 29, 2023 16:58:03 GMT 1
Q: will I be able to copy text from HTML A: Yes just done a copy All CTRL A ; CTRL C The BAsic CONverter Forum Skip Navigation Home * Help * Search * Goto the BaCon website * Welcome Guest. Please Login or Register.
The BAsic CONverter Forum Home General * News * Documentation * Code Projects * Troubleshooting area * Bugs, features * General Board Threads Posts Last Post News
News and announcements
Moderator: Pjot
109 906 BaCon 4.6.1 released by vovchik Mar 1, 2023 22:55:44 GMT 1 Documentation
Tutorials & demonstrations
Moderator: Pjot
157 2,299 Hug Imager by alexfish Apr 29, 2023 16:07:44 GMT 1 Code Projects
Programs, challenges, competitions
Moderator: Pjot
243 5,561 String concatenation in BaCon by bigbass Apr 16, 2023 15:10:41 GMT 1 Troubleshooting area
Problems, issues, tips & tricks
Moderator: Pjot
447 3,268 variable y1 bug [Solved] by ptitjoz Apr 23, 2023 7:44:39 GMT 1 Bugs, features
Report a bug, request a feature
Moderator: Pjot
310 2,955 fossil beta testing feedback by bigbass Apr 28, 2023 14:12:18 GMT 1 Legend New Posts No New Posts Forum Information & Statistics Threads and Posts Total Threads: 1,266 Total Posts: 14,989 Last Updated: Hug Imager by alexfish (Apr 29, 2023 16:07:44 GMT 1) Recent Threads - Recent Posts - RSS Feed Members Total Members: 158 Newest Member: terc Most Users Online: 233 (Jul 19, 2021 20:23:56 GMT 1) View today's birthdays Users Online 0 Staff, 2 Members, 2 Guests. vovchik, alexfish Users Online in the Last 24 Hours 1 Staff, 2 Members, 91 Guests. Pjot
Click here to remove banner ads from this forum. This Forum Is Hosted For FREE By ProBoards Get Your Own Free Forum! Terms of Service Privacy Cookies FTC Disclosure Report Abuse Do Not Sell My Personal Information Consent if just want selected text : CTRL C ADDED: Callback responce can get the link as a reference + doc reference the link click example Link; 31548080 Link; 31547808 Link; 31637904 Link; 28571024 Link; 30068664 Link; 31559080 Now need to find the actual bits I am Link; 32451032 which method DO I LIKE weasyprint & linksplus that will make one get used to web crawling ' and store rather than FOOGLE it Which came first ? so you become your own FOOGLER https://www.britannica.com/dictionary/bacon then easy to copy links and paste to end of url https://www.basic-converter.org/ and clock.bac.html other picky is view code clock then on dowload page download the code Attachments:
|
|
|
Post by alexfish on Apr 29, 2023 23:07:39 GMT 1
Its A Wrap and load of image - almost instant update Lib still on time Attachments:
|
|
|
Post by alexfish on Apr 30, 2023 19:34:09 GMT 1
Hi All "hug3.5.1" First Post BR Alex Test web bits Requires pyhon weasyprint Will post other option later, like firefox & gtkhtml INCLUDE "hug351.bac" HUGOPTIONS("NOSCALING") '======================================================= HOME$= GETENVIRON$("HOME") '======================================================= PRINT HUG_VERSION$ GLOBAL BASE$ '====================================================== FUNCTION WEBVIEW(hug_xsize,hug_ysize)
LOCAL view, scrolled,image,ebox LOCAL pixbuf image = gtk_image_new() ebox = gtk_event_box_new() scrolled = gtk_scrolled_window_new(0, 0) gtk_scrolled_window_set_policy(scrolled, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC) gtk_scrolled_window_set_shadow_type(scrolled, GTK_SHADOW_ETCHED_OUT) gtk_container_add(scrolled, image)
IF HUG_WIDGET_SHOW THEN gtk_widget_show_all(scrolled) ' - width if put in another scroller hug_widget_xsize(STR$(scrolled)) = hug_xsize hug_widget_ysize(STR$(scrolled)) = hug_ysize
hug_widget_signal(STR$(ebox)) = 4 hug_widget_s_widget(STR$(scrolled))=ebox hug_widget_type$(STR$(ebox)) = "image"
hug_widget_font(STR$(scrolled)) = image hug_widget_focus(STR$(ebox)) = image '======================================================
RETURN scrolled
END FUNCTION '====================================================== SUB LINKS(long hugwidget,STRING url$,STRING links$) LOCAL dim LOCAL txt$ links$ = REPLACE$(links$,"'",CHR$(34)) 'TEXT(hugwidget,"")
TEXT(hugwidget,url$) SPLIT links$ BY NL$ TO arg$ SIZE dim FOR t = 0 TO dim -1 txt$= arg$[t] txt$= MID$(txt$,INSTR(txt$,"=")+1) txt$= MID$(txt$,1,INSTR(txt$,"=")-1) txt$= MID$(txt$,INSTR(txt$,CHR$(34))+1) txt$= MID$(txt$,1,INSTR(txt$,CHR$(34))-1) txt$= MID$(txt$,1,INSTR(txt$,"</")-1) 'txt$= MID$(txt$,INSTR(txt$,CHR$(34))-1)
IF LEN(txt$) AND NOT(INSTR(txt$,"<")) THEN IF BASE$ = url$ THEN TEXT(hugwidget,txt$) ELSE TEXT(ed,txt$) TEXT(ed,NL$) END IF END IF NEXT END SUB '====================================================== FUNCTION ParseUrls$(STRING html$) LOCAL txt$,res$,rte$ LOCAL ptr txt$ = LOAD$(html$) txt$= REPLACE$(txt$,NL$,"") txt$= REPLACE$(txt$,">", NL$)
LOCAL dim SPLIT txt$ BY NL$ TO arg$ SIZE dim FOR t = 0 TO dim -1 res$ = arg$[t] res$ = CHOP$(res$) IF INSTR(res$,"src=") OR INSTR(res$,"href=") THEN INCR ptr rte$ = rte$ & "[" & STR$(ptr) & "] " & res$ & NL$ END IF NEXT RETURN rte$ END FUNCTION '====================================================== SUB Load_Url(long hug_widget,STRING url$)
LOCAL layer, buffer,image,ebox,buf,res LOCAL new$,cmd$
image = hug_widget_font(STR$(hug_widget)) PRINT "IM is ", image
IF INSTR(url$,"http") AND INSTR(url$,"://") THEN PRINT "url :", url$ IF (INSTR(url$,".png") OR INSTR(url$,".jpg")) THEN IF (INSTR(url$,".png")) THEN cmd$ = "curl " & url$ & CHR$(32) & "-o " & HOME$ & "/test12.png" SYSTEM (cmd$) IF FILEEXISTS(HOME$ & "/test12.png") THEN
pixbuf = gdk_pixbuf_new_from_file(HOME$ & "/test12.png", 0) PRINT pixbuf res = gdk_pixbuf_get_width(pixbuf) PRINT res gtk_image_clear(image) gtk_image_set_from_pixbuf (image,pixbuf) g_object_unref(pixbuf) ' END IF
END IF
IF (INSTR(url$,".jpg")) THEN cmd$ = "curl " & url$ & CHR$(32) & "-o " & HOME$ & "/test12.jpg" SYSTEM (cmd$) IF FILEEXISTS(HOME$ & "/test12.jpg") THEN
pixbuf = gdk_pixbuf_new_from_file(HOME$ & "/test12.jpg", 0) PRINT pixbuf res = gdk_pixbuf_get_width(pixbuf) PRINT res gtk_image_clear(image) gtk_image_set_from_pixbuf (image,pixbuf) g_object_unref(pixbuf) ' END IF
END IF
ELSE cmd$ = "weasyprint -p -r 90 -q -f png " & url$ & CHR$(32) & HOME$ & "/test8.png" SYSTEM (cmd$) IF FILEEXISTS(HOME$ & "/test8.png") THEN
pixbuf = gdk_pixbuf_new_from_file(HOME$ & "/test8.png", 0) PRINT pixbuf res = gdk_pixbuf_get_width(pixbuf) PRINT res gtk_image_clear(image) gtk_image_set_from_pixbuf (image,pixbuf) g_object_unref(pixbuf) ' END IF END IF END IF PRINT hug_widget_xsize(STR$(hug_widget)) END SUB '====================================================== SUB LoadHtml(long hug_widget,STRING url$)
LOCAL layer, buffer,image,ebox,buf,res LOCAL new$,cmd$
image = hug_widget_font(STR$(hug_widget))
cmd$ = "weasyprint -p -r 90 -q -f png " & url$ & CHR$(32) & HOME$ & "/test8.png" SYSTEM (cmd$) IF FILEEXISTS(HOME$ & "/test8.png") THEN
pixbuf = gdk_pixbuf_new_from_file(HOME$ & "/test8.png", 0) PRINT pixbuf res = gdk_pixbuf_get_width(pixbuf) PRINT res gtk_image_clear(image) gtk_image_set_from_pixbuf (image,pixbuf) g_object_unref(pixbuf) ' END IF END SUB '====================================================== DECLARE TOG
SUB togList()
TOG=NOT(TOG) IF (TOG) THEN SHOW(list) ELSE HIDE(list) END IF SYNC END SUB '====================================================== SUB GetUrl() PRINT IF TOG THEN togList END IF
LOCAL txt$,cmdf2$,urlsd$ txt$ = GRAB$(list) IF NOT(INSTR(txt$,"http")) THEN txt$ = BASE$ & txt$ END IF TEXT(ent,txt$) cmdf2$ = "curl " & txt$ & CHR$(32) & "-o " & HOME$ & "/index.html" SYSTEM (cmdf2$) urlsd$ = ParseUrls$(HOME$ & "/index.html") LINKS(list,txt$,urlsd$)
Load_Url(web,txt$) END SUB
'================================================================================= SUB SetUrl()
IF TOG THEN togList END IF LOCAL txt$,cmd$,urls$,cmdf2$,urlsd$ txt$ = GRAB$(ent)
IF ((INSTR(txt$,"http")) AND (INSTR(txt$,"://") ) ) THEN cmdf2$ = "curl " & txt$ & CHR$(32) & "-o " & HOME$ & "/index.html" SYSTEM (cmdf2$) urlsd$ = ParseUrls$(HOME$ & "/index.html") LINKS(list,txt$,urlsd$)
Load_Url(web,txt$) END IF END SUB
'================================================================================= win = WINDOW("Web-View", 806, 606)
'NOTEBOOK returns notebook no pages ===== NoteBook =NOTEBOOK("WebView ",800,600) ATTACH(win,NoteBook,3,3)
'add first page page1 = PAGE(NoteBook,"Web View")
ent = ENTRY("http://www.basic-converter.org/",400,-1) CALLBACK(ent,SetUrl)
PAGESET(page1,ent,3,3) but = BUTTON("L",-1,-1) PAGESET(page1,but,406,3) CALLBACK(but,togList) web = WEBVIEW(780,520) PAGESET(page1,web,3,40) list = LIST(323,200) CALLBACK(list,GetUrl) cmdf$ = "curl " & "http://www.basic-converter.org/" & CHR$(32) & "-o " & HOME$ & "/index.html" SYSTEM (cmdf$) urls$ = ParseUrls$(HOME$ & "/index.html") BASE$ = "http://www.basic-converter.org/" LINKS(list,"http://www.basic-converter.org/",urls$)
PAGESET(page1,list,457,3)
page2 = PAGE(NoteBook,"LINKS") ed = EDIT(780,530) PAGESET(page2,ed,3,3) page$ = LOAD$(HOME$ & "/index.html")
'Load_Url(web,"http://www.basic-converter.org/") LoadHtml(web,"index.html") SETPAGE(NoteBook, 0) HIDE(list) '============================== DISPLAY '==============================
the list stores base url + links::click or enter new url press return. edit stores external links of other sites visited : viola foogle edit tin can phone Picky and from that one ,can see the url parser need sorting <script Updated fix Update fix mem leak:: gtk_image_set_from_pixbuf bug is back FIX gtk_image_clear(image) First the app now runs at about 89 to 90 mb Attachments:
|
|