git 项目上传

1、git add .        (注:别忘记后面的.,此操作是把Test文件夹下面的文件都添加进来)

2、git commit  -m  "first commit"  (注:“提交信息”里面换成你需要,如“first commit”)

3、git push -u origin master   (注:此操作目的是把本地仓库push到github上面,此步骤需要你输入帐号和密码)



from PyQt5 import QtWidgets,QtCore,QtGui
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
import sys,os,requests
from PyQt5.QtWebEngineWidgets import *


class UI(QMainWindow,):
    def __init__(self):
        super(UI, self).__init__()
        self.setWindowTitle('Web browser')
        self.resize(1000,1000)
        # self.setWindowIcon(QtGui.QIcon('./liulanqi.png'))
        # self.main_toolbar = QtWidgets.QToolBar()
        # self.main_toolbar.setIconSize(QtCore.QSize(1,1))
        # self.addToolBar(self.main_toolbar)
        self.tabs = QtWidgets.QTabWidget()

        # self.tabs.setDocumentMode(True)
        # self.tabs.setTabsClosable(True)
        self.tabs_layout = QGridLayout()
        self.tabs.setLayout(self.tabs_layout)
        # self.url_edit = QtWidgets.QLineEdit()


        self.browser = QWebEngineView()
        Url = 'http://192.168.0.100/hs/dzkb0/main/index.php?loginname=503&password=123456'
        self.browser.setUrl(QtCore.QUrl(Url))
        self.tabs_layout.addWidget(self.browser)
        # self.tabs.addTab(self.browser,'')
        # self.browser.loadFinished.connect(lambda :self.tabs.setTabText(0,self.browser.page().title()))
        self.setCentralWidget(self.tabs)



        # self.turn_button = QAction(QIcon('./zhuandao.png'),'Turn',self)
        # self.back_button = QAction(QIcon('./fanhui.png'),'Back',self)
        # self.next_button = QAction(QIcon('./tiaozhuan.png'),'Forward',self)
        # self.stop_button = QAction(QIcon('./close.png'),'Stop',self)
        # self.reload_button = QAction(QIcon('./shuaxin.png'),'Reload',self)
        # self.add_button = QAction(QIcon('./add.png'),'Addpage',self)



        # self.main_toolbar.addAction(self.back_button)
        # self.main_toolbar.addAction(self.next_button)
        # self.main_toolbar.addAction(self.stop_button)
        # self.main_toolbar.addAction(self.reload_button)
        # self.main_toolbar.addAction(self.add_button)
        # self.main_toolbar.addWidget(self.url_edit)
        # self.main_toolbar.addAction(self.turn_button)



        # self.back_button.triggered.connect(self.browser.back)
        # self.next_button.triggered.connect(self.browser.forward)
        # self.stop_button.triggered.connect(self.browser.close)
        # self.reload_button.triggered.connect(self.browser.reload)
        # self.turn_button.triggered.connect(self.OpenUrlLine)
        # self.browser.urlChanged.connect(self.setUrlLine)
        # self.tabs.tabBarDoubleClicked.connect(self.NewPage)
        # self.add_button.triggered.connect(self.NewPage)
        # self.tabs.tabCloseRequested.connect(self.Closepage)


    #
    # def setUrlLine(self,url):
    #     self.url_edit.setText(url.toString())

    def OpenUrlLine(self):
        self.urlline = self.url_edit.text()
        print(self.urlline)
        self.browser.setUrl(QtCore.QUrl(self.urlline))

    def NewPage(self,url='http://www.baidu.com',label=''):
        browser = QWebEngineView()
        Url = 'http://www.baidu.com'
        browser.setUrl(QtCore.QUrl(Url))
        i = self.tabs.addTab(browser,label)
        self.tabs.setCurrentIndex(i)
        print(i)

        browser.loadFinished.connect(lambda :self.tabs.setTabText(i,browser.page().title()))

    def Closepage(self,i):
        if self.tabs.count() < 2:
            return
        self.tabs.removeTab(i)




if __name__ == '__main__':
    app = QApplication(sys.argv)


    gui = UI()
    gui.showFullScreen()
    gui.show()
    sys.exit(app.exec_())

评论

刷新

友情链接