Skip to content

Commit

Permalink
fixed minor bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mjishnu committed Jul 10, 2022
1 parent 58c302e commit d4a3932
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions get_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,34 @@ def __init__(self):


def setupUi(self,qt_window):
#all helper functions
def navigate_to_url():

# getting url and converting it to QUrl object
q = QUrl(qt_window.urlbar.text())

# if url is scheme is blank
if q.scheme() == "":
# set url scheme to html
q.setScheme("http")

# set the url to the browser
qt_window.browser.setUrl(q)

# method for updating url
# this method is called by the QWebEngineView object
def update_urlbar(q):

# setting text to the url bar
qt_window.urlbar.setText(q.toString())

# setting cursor position of the url bar
qt_window.urlbar.setCursorPosition(0)

def current_url():
qt_window.close()
self.closed.emit(str(qt_window.urlbar.text()))

# set the title
qt_window.setWindowTitle("App Selector")
# creating a QWebEngineView
Expand All @@ -26,7 +54,7 @@ def setupUi(self,qt_window):
QUrl("https://apps.microsoft.com/"))

# adding action when url get changed
qt_window.browser.urlChanged.connect(lambda arg:self.update_urlbar(qt_window,arg))
qt_window.browser.urlChanged.connect(update_urlbar)

# set this browser as central widget or main window
qt_window.setCentralWidget(qt_window.browser)
Expand Down Expand Up @@ -101,37 +129,9 @@ def setupUi(self,qt_window):
qt_window.select_btn.setText("Select")
qt_window.select_btn.setStatusTip("Select The File To Download")
qt_window.select_btn.setIcon(QIcon('Images/ok.png'))
qt_window.select_btn.clicked.connect(lambda arg:self.current_url(qt_window))
qt_window.select_btn.clicked.connect(current_url)
navtb.addWidget(qt_window.select_btn)
qt_window.urlbar.returnPressed.connect(lambda arg: self.navigate_to_url(qt_window))

def navigate_to_url(self,qt_window):

# getting url and converting it to QUrl object
q = QUrl(qt_window.urlbar.text())

# if url is scheme is blank
if q.scheme() == "":
# set url scheme to html
q.setScheme("http")

# set the url to the browser
qt_window.browser.setUrl(q)

# method for updating url
# this method is called by the QWebEngineView object
def update_urlbar(self,qt_window,q):

# setting text to the url bar
qt_window.urlbar.setText(q.toString())

# setting cursor position of the url bar
qt_window.urlbar.setCursorPosition(0)

def current_url(self,qt_window):
qt_window.close()
self.closed.emit(str(qt_window.urlbar.text()))

qt_window.urlbar.returnPressed.connect(navigate_to_url)
def url_grabber():
import sys

Expand Down

0 comments on commit d4a3932

Please sign in to comment.