Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

added ModernDialog and ModernMessageBox #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

razaqq
Copy link
Contributor

@razaqq razaqq commented Feb 6, 2020

ModernDialog is used just like a QDialog.

d = ModernDialog(hideWindowButtons=True)
d.setWindowTitle('Changelog')

main_layout = QVBoxLayout()
main_layout.setSpacing(10)

text = QTextEdit()
text.setPlainText('This is a text\nto demonstrate\na ModernDialog')
text.setReadOnly(True)
text.setFixedHeight(100)
main_layout.addWidget(text, alignment=Qt.AlignCenter)

button_box = QDialogButtonBox()
button_box.setOrientation(Qt.Horizontal)
button_box.setStandardButtons(QDialogButtonBox.Ok)
button_box.setCenterButtons(True)
button_box.accepted.connect(d.accept)
main_layout.addWidget(button_box, alignment=Qt.AlignCenter)

d.windowContent.setLayout(main_layout)
d.exec()

grafik

ModernMessageBox is used just like a QMessageBox
Simple example below

box = ModernMessageBox()
box.setIcon(QMessageBox.Question)
box.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
box.setEscapeButton(QMessageBox.No)
box.setText("There is a new version available.\nWould you like to update now?")

if box.exec_() == QMessageBox.Yes:
    box.hide()
    print('yes')
else:
    print('no')
    box.hide()

grafik

@razaqq
Copy link
Contributor Author

razaqq commented Feb 17, 2020

should be done

however the merging of all the changes from the other pull request of hiding window buttons was detected horribly by git, which made this a mess...

i could redo this pull request if you want

@Jerakin
Copy link
Collaborator

Jerakin commented Feb 17, 2020

should be done

however the merging of all the changes from the other pull request of hiding window buttons was detected horribly by git, which made this a mess...

i could redo this pull request if you want

I do Squash and Merge while incorperating "single fixes" that can be understood without all git history. Though in this case the changed files looks a bit odd so please create a new PR with the changes. :)

@razaqq
Copy link
Contributor Author

razaqq commented Feb 18, 2020

okay i have redone this starting with the current origin/master.
Force pushed over this branch, so we are back to a single commit

self.on_btnRestore_clicked()


class ModernDialog(QDialog):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shares a lot of code with ModernWindow, maybe all of it? I think it would be a good idea to break it into a ModernWidget which inherits QWidget that then contains the shared code from ModernWindow and ModernDialog. Window and Dialog can then inherit the ModernWidget istead of QWidget.

self.vboxFrame = QVBoxLayout(self.windowFrame)
self.vboxFrame.setContentsMargins(0, 0, 0, 0)

self.titleBar = TitleBar(self)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def __child_was_closed(self): on line 306 is never used

@iron3oxide
Copy link

Is this project still active? I'd really love to have these features and would implement them myself, but it would take some work to understand the code as the documentation is somewhat scarce.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants