Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replace default show_message by a popup gui, samish appearance, close…
…d by user, text copyable.
- Loading branch information
1 parent
8118e5f
commit d682e62
Showing
3 changed files
with
133 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#!/usr/bin/env python | ||
|
||
import sys | ||
import signal | ||
from PyQt4 import QtGui | ||
from PyQt4 import QtCore | ||
from PyQt4.QtCore import Qt | ||
|
||
class TitleBar(QtGui.QDialog): | ||
def __init__(self, parent=None): | ||
QtGui.QWidget.__init__(self, parent) | ||
self.setWindowFlags(Qt.FramelessWindowHint) | ||
self.setStyle(QtGui.QStyleFactory.create('CleanLooks')) | ||
css = """ | ||
QWidget | ||
{ | ||
Background:lightyellow; | ||
color:black; | ||
font:12px bold; | ||
font-weight:bold; | ||
border-radius: 5px; | ||
height: 11px; | ||
} | ||
QToolButton | ||
{ | ||
font:12px | ||
Background:lightyellow; | ||
} | ||
QToolButton:hover | ||
{ | ||
font:12px | ||
Background:yellow; | ||
} | ||
""" | ||
self.setStyleSheet(css) | ||
|
||
close=QtGui.QToolButton(self); | ||
close.setIcon(QtGui.QIcon('/usr/share/icons/sdwdate-gui/1441238560_close.png')) | ||
close.clicked.connect(self.close); | ||
|
||
title = QtGui.QLabel(self); | ||
title.setText("Time Synchronisation Monitor "); | ||
|
||
title_layout=QtGui.QHBoxLayout(self); | ||
title_layout.addWidget(title); | ||
title_layout.addWidget(close); | ||
|
||
def close(self): | ||
popup.close() | ||
|
||
|
||
class Frame(QtGui.QFrame): | ||
def __init__(self, parent=None): | ||
QtGui.QFrame.__init__(self, parent) | ||
css = """ | ||
QFrame | ||
{ | ||
Background:lightyellow; | ||
color:black; | ||
font:12px ; | ||
border-radius: 5px; | ||
} | ||
""" | ||
self.setStyleSheet(css) | ||
self.setWindowFlags(Qt.FramelessWindowHint); | ||
self.m_content= QtGui.QWidget(self); | ||
self.m_titleBar= TitleBar(self); | ||
|
||
frame_layout = QtGui.QVBoxLayout(self); | ||
frame_layout.addWidget(self.m_titleBar); | ||
frame_layout.addWidget(self.m_content); | ||
frame_layout.setMargin(5); | ||
|
||
# Allows you to access the content area of the frame | ||
# where widgets and layouts can be added | ||
def contentWidget(self): | ||
return self.m_content | ||
|
||
if __name__ == '__main__': | ||
app = QtGui.QApplication(sys.argv); | ||
msg = sys.argv[1] | ||
popup = Frame() | ||
|
||
content = QtGui.QVBoxLayout(popup.contentWidget()); | ||
content.setMargin(0); | ||
|
||
text = QtGui.QLabel() | ||
text.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse | | ||
QtCore.Qt.TextSelectableByMouse) | ||
text.setText(msg) | ||
|
||
content.addWidget(text) | ||
popup.move(int(sys.argv[2]), int(sys.argv[3])); | ||
popup.show() | ||
app.exec_() |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.