Add files via upload
From Dialog to DockWidget. Adding nicer placement of input fields
This commit is contained in:
parent
92f9c5d938
commit
1f4c0672a2
1 changed files with 98 additions and 118 deletions
|
@ -86,6 +86,10 @@ class textforart:
|
|||
|
||||
|
||||
class DockerLinkGrepper(DockWidget):
|
||||
global link
|
||||
global html
|
||||
global linkdata
|
||||
global content
|
||||
|
||||
|
||||
# svg
|
||||
|
@ -113,39 +117,6 @@ class DockerLinkGrepper(DockWidget):
|
|||
</svg>'''.encode('utf-8')
|
||||
return(svg)
|
||||
|
||||
coffee = '''\
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="800px" height="600px" viewBox="0 0 24 24" fill="#000000">
|
||||
<path d="M0 0h24v24H0V0z" fill="none"/>
|
||||
<path d="M4 19h16v2H4zM20 3H4v10c0 2.21 1.79 4 4 4h6c2.21 0 4-1.79 4-4v-3h2c1.11 0 2-.9 2-2V5c0-1.11-.89-2-2-2zm-4 10c0 1.1-.9 2-2 2H8c-1.1 0-2-.9-2-2V5h10v8zm4-5h-2V5h2v3z"/>
|
||||
<text x="0.2" y="22.5" font-size="0.1em">𝕶𝖗𝖎𝖙𝖆 𝖓𝖊𝖊𝖉𝖘 𝖒𝖔𝖔𝖗𝖊 𝕮𝖔𝖋𝖋𝖊𝖊!</text>
|
||||
</svg>'''.encode('utf-8')
|
||||
|
||||
|
||||
recording = 0
|
||||
|
||||
|
||||
|
||||
def newButtonIsClicked(self):
|
||||
text = 'Welcome fellow human beeing ^.^'
|
||||
print(text)
|
||||
#content = line.text()
|
||||
|
||||
# aktivate Checkbox if input is done
|
||||
#if line.text():
|
||||
# newCheckbox.setCheckState(2)
|
||||
#parser = MyHTMLParser()
|
||||
#link = urllib.request.urlopen(content).read().decode()
|
||||
#html = parser.feed(link)
|
||||
#global linkdata
|
||||
# get data, remove newline
|
||||
#linkdata = parser.data
|
||||
#print(linkdata)
|
||||
#newDialog.close()
|
||||
#else:
|
||||
#newCheckbox.setCheckState(0)
|
||||
#print('Please insert a valid Link! Thank you..')
|
||||
#return
|
||||
|
||||
def add_svg(svg):
|
||||
clipboard = QGuiApplication.clipboard()
|
||||
mime_data = QMimeData()
|
||||
|
@ -171,16 +142,23 @@ class DockerLinkGrepper(DockWidget):
|
|||
add_svg(svg)
|
||||
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setWindowTitle("Url to Art")
|
||||
mainWidget = QWidget(self)
|
||||
self.setWidget(mainWidget)
|
||||
|
||||
# add button and layout for button
|
||||
layoutForButtons = QHBoxLayout()
|
||||
newButton = QPushButton("load text")
|
||||
newButton = QPushButton("load text", mainWidget)
|
||||
newButton.move(100, 700)
|
||||
layoutForButtons.addWidget(newButton)
|
||||
#layoutForButtons.addSpacing(200)
|
||||
|
||||
# label
|
||||
nameLabel = QLabel()
|
||||
nameLabel.setText('Please input a link:')
|
||||
layoutForButtons.addWidget(nameLabel)
|
||||
|
||||
#layoutForButtons.addWidget(nameLabel)
|
||||
|
||||
#input field
|
||||
line = QLineEdit()
|
||||
|
@ -192,19 +170,21 @@ class DockerLinkGrepper(DockWidget):
|
|||
|
||||
# write some actions
|
||||
clicked = 'Button clicked'
|
||||
newButton.clicked.connect(newButtonIsClicked)
|
||||
|
||||
parser = MyHTMLParser()
|
||||
content = line.text()
|
||||
|
||||
#add a checkbox
|
||||
newCheckbox = QCheckBox()
|
||||
newCheckbox.setText('realise input')
|
||||
link = layoutForButtons.addWidget(newCheckbox)
|
||||
layoutForButtons.addWidget(newCheckbox)
|
||||
mainWidget.setLayout(layoutForButtons)
|
||||
mainWidget.layout().addWidget(newButton)
|
||||
|
||||
# create dialog and show it
|
||||
newDialog = QDialog()
|
||||
newDialog.setLayout(layoutForButtons)
|
||||
newDialog.setWindowTitle("Loader")
|
||||
newDialog.exec_() # show the dialog
|
||||
newButton.clicked.connect(lambda: newCheckbox.setCheckState(2))
|
||||
newCheckbox.clicked.connect(lambda: parser.feed(urllib.request.urlopen(content).read().decode()))
|
||||
#parser.feed(urllib.request.urlopen(content).read().decode())
|
||||
#link = urllib.request.urlopen(content).read().decode()
|
||||
linkdata = parser.data
|
||||
|
||||
# language
|
||||
language = ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue