-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from lukasc-ubc/master
Update from Master
- Loading branch information
Showing
6 changed files
with
216 additions
and
89 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
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
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,63 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<klayout-macro> | ||
<description/> | ||
<version/> | ||
<category>pymacros</category> | ||
<prolog/> | ||
<epilog/> | ||
<doc/> | ||
<autorun>false</autorun> | ||
<autorun-early>false</autorun-early> | ||
<shortcut/> | ||
<show-in-menu>false</show-in-menu> | ||
<group-name/> | ||
<menu-path/> | ||
<interpreter>python</interpreter> | ||
<dsl-interpreter-name/> | ||
<text>import pya | ||
|
||
class ScreenshotDialog(pya.QDialog): | ||
""" | ||
This class implements a dialog with a screenshot display area and a | ||
screenshot button | ||
""" | ||
|
||
def button_clicked(self, checked): | ||
""" Event handler: "Screenshot" button clicked """ | ||
|
||
view = pya.Application.instance().main_window().current_view() | ||
|
||
# get the screenshot and place it in the image label | ||
if not view is None: | ||
self.image.setPixmap(pya.QPixmap.fromImage(view.get_image(400, 400))) | ||
else: | ||
self.image.setText("No layout opened to take screenshot from") | ||
|
||
def __init__(self, parent = None): | ||
""" Dialog constructor """ | ||
|
||
super(ScreenshotDialog, self).__init__() | ||
|
||
self.setWindowTitle("Screenshot Saver") | ||
|
||
self.resize(400, 120) | ||
|
||
layout = pya.QVBoxLayout(self) | ||
self.setLayout(layout) | ||
|
||
self.image = pya.QLabel("Press the button to fetch a screenshot", self) | ||
layout.addWidget(self.image) | ||
|
||
button = pya.QPushButton('Screenshot', self) | ||
button.setFont(pya.QFont('Times', 18, pya.QFont.Bold)) | ||
layout.addWidget(button) | ||
|
||
# attach the event handler | ||
button.clicked(self.button_clicked) | ||
|
||
# Instantiate the dialog and make it visible initially. | ||
# Passing the main_window will make it stay on top of the main window. | ||
dialog = ScreenshotDialog(pya.Application.instance().main_window()) | ||
dialog.show() | ||
</text> | ||
</klayout-macro> |
Oops, something went wrong.