text
stringlengths
0
828
dict_[""tooltip""] = toolTips[i]
specs.append((name, dict_))
form = XParametersEditor(specs=specs, title=title)
r = form.exec_()
return r, form"
4150,"def place_left_top(window, width=None, height=None):
""""""Places window in top left corner of screen.
Arguments:
window -- a QWidget
width=None -- window width, in case you want to change it (if not passed, not changed)
height=None -- window height, in case you want to change it (if not passed, not changed)
""""""
if width is None:
width = window.width()
if height is None:
height = window.height()
window.setGeometry(_DESKTOP_OFFSET_LEFT, _DESKTOP_OFFSET_TOP, width, height)"
4151,"def place_center(window, width=None, height=None):
""""""Places window in the center of the screen.""""""
screenGeometry = QApplication.desktop().screenGeometry()
w, h = window.width(), window.height()
if width is not None or height is not None:
w = width if width is not None else w
h = height if height is not None else h
window.setGeometry(0, 0, w, h)
x = (screenGeometry.width() - w) / 2
y = (screenGeometry.height() - h) / 2
window.move(x, y)"
4152,"def snap_left(window, width=None):
""""""Snaps window to left of desktop.
Arguments:
window -- a QWidget
width=None -- window width, in case you want to change it (if not passed, not changed)
""""""
if not width:
width = window.width()
rect = QApplication.desktop().screenGeometry()
window.setGeometry(_DESKTOP_OFFSET_LEFT, _DESKTOP_OFFSET_TOP, width, rect.height())"
4153,"def snap_right(window, width=None):
""""""Snaps window to right of desktop.
Arguments:
window -- a QWidget
width=None -- window width, in case you want to change it (if not passed, not changed)
""""""
if not width:
width = window.width()
rect = QApplication.desktop().screenGeometry()
window.setGeometry(rect.width()-width, _DESKTOP_OFFSET_TOP, width, rect.height())"
4154,"def get_matplotlib_layout(widget, flag_toolbar=True):
""""""
Creates figure, toolbar, layout, sets widget layout
Returns figure, canvas, layout
Reference: http://stackoverflow.com/questions/12459811
""""""
fig = plt.figure()
canvas = FigureCanvas(fig)
# self.canvas.mpl_connect('button_press_event', self.on_plot_click)
layout = QVBoxLayout(widget)
if flag_toolbar:
toolbar = NavigationToolbar2QT(canvas, widget)
layout.addWidget(toolbar)
layout.addWidget(canvas)
a99.set_margin(layout, 0)
return fig, canvas, layout"
4155,"def get_icon(keyword):
""""""
Transforms a PNG file in a QIcon
Looks for a file named <keyword>.png in the ""icons"" directory
If file does not exist, returns None
""""""
filename = a99.get_path( ""icons"", keyword + "".png"")
if not os.path.isfile(filename):
raise FileNotFoundError(""File '{}' does not exist"".format(filename))
return QIcon(filename)"
4156,"def get_QApplication(args=[]):
""""""Returns the QApplication instance, creating it is does not yet exist.""""""
global _qapp
if _qapp is None:
QCoreApplication.setAttribute(Qt.AA_X11InitThreads)
_qapp = QApplication(args)
return _qapp"
4157,"def table_info_to_parameters(table_info):
""""""
Converts a list of MyDBRow into a parameters.Parameters object