Skip to content

Commit

Permalink
Started Project
Browse files Browse the repository at this point in the history
synced the project
  • Loading branch information
Rick0038 committed Sep 8, 2021
1 parent f57209f commit e8b5691
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 0 deletions.
5 changes: 5 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

My 1st appempt at GUI application .
This is a basic Python based youtube client.

I used Glade to make the UI
33 changes: 33 additions & 0 deletions src/Browzee.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/python3.8
# -*- coding: utf-8 -*-

from gi.repository import Gtk, WebKit2 ## ( To import required libery and webkit )

class Handler:

def backbutton_clicked(self, button):
browserholder.go_back() ## ( clicks on the Back button, the '.go_back()' is activated )

def refreshbutton_clicked(self, button):
browserholder.reload() ## ( '.reload()' is activated when the 'Refresh' button is clicked. )

def enterkey_clicked(self, button):
browserholder.load_uri(urlentry.get_text()) ## ( To '.load_uri()' input URL )

builder = Gtk.Builder() ## ( builder specified )
builder.add_from_file("/ui/ui.glade") ## ( imported the 'ui.glade' file. )
builder.connect_signals(Handler()) ## ( handeler pass through )
window = builder.get_object("window1") ## ( to create a window )
browserholder = WebKit2.WebView() ## ( to hold the webkit engine in app )

browserholder.set_editable(False) ## ( to disallow editing the webpage. )
browserholder.load_uri("https://www.youtube.com/") ## ( the default URL to be loaded )
urlentry = builder.get_object("entry1") ## ( to take url entry from object as entry 1 )
urlentry.set_text("https://www.youtube.com") ## ( to load default site in address bar )

scrolled_window = builder.get_object("scrolledwindow1") ## ( importe the scrolledwindow1 object from the ui.glade )
scrolled_window.add(browserholder) ## ( enebels scrolling function in window )
browserholder.show() ## ( to show the browser.holder and its content in window )
window.connect("delete-event", Gtk.main_quit) ## ( to kill running load when press end )
window.show_all() ## ( to show all running gtk window functions )
Gtk.main() ## ( gtk main conclude )
98 changes: 98 additions & 0 deletions src/ui/ui.glade
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.2 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Browzee</property>
<property name="window_position">center</property>
<property name="default_width">1000</property>
<property name="default_height">600</property>
<property name="hide_titlebar_when_maximized">True</property>
<property name="icon_name">folder-remote-symbolic</property>
<child type="titlebar">
<placeholder/>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkButton" id="button1">
<property name="label">gtk-go-back</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="relief">half</property>
<property name="use_stock">True</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="backbutton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button2">
<property name="label">gtk-refresh</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="relief">half</property>
<property name="use_stock">True</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="refreshbutton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
<signal name="activate" handler="enterkey_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">always</property>
<property name="shadow_type">in</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

0 comments on commit e8b5691

Please sign in to comment.