本文整理汇总了Python中PyQt4.Qt.QCoreApplication.instance方法的典型用法代码示例。如果您正苦于以下问题:Python QCoreApplication.instance方法的具体用法?Python QCoreApplication.instance怎么用?Python QCoreApplication.instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QCoreApplication
的用法示例。
在下文中一共展示了QCoreApplication.instance方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt4.Qt import QCoreApplication [as 别名]
# 或者: from PyQt4.Qt.QCoreApplication import instance [as 别名]
def __init__(self, parent, view, row, link_delegate):
QDialog.__init__(self, parent)
Ui_BookInfo.__init__(self)
self.setupUi(self)
self.gui = parent
self.cover_pixmap = None
self.details.sizeHint = self.details_size_hint
self.details.page().setLinkDelegationPolicy(self.details.page().DelegateAllLinks)
self.details.linkClicked.connect(self.link_clicked)
self.css = P('templates/book_details.css', data=True).decode('utf-8')
self.link_delegate = link_delegate
self.details.setAttribute(Qt.WA_OpaquePaintEvent, False)
palette = self.details.palette()
self.details.setAcceptDrops(False)
palette.setBrush(QPalette.Base, Qt.transparent)
self.details.page().setPalette(palette)
self.view = view
self.current_row = None
self.fit_cover.setChecked(dynamic.get('book_info_dialog_fit_cover',
True))
self.refresh(row)
self.connect(self.view.selectionModel(), SIGNAL('currentChanged(QModelIndex,QModelIndex)'), self.slave)
self.connect(self.next_button, SIGNAL('clicked()'), self.next)
self.connect(self.previous_button, SIGNAL('clicked()'), self.previous)
self.fit_cover.stateChanged.connect(self.toggle_cover_fit)
self.cover.resizeEvent = self.cover_view_resized
self.cover.cover_changed.connect(self.cover_changed)
desktop = QCoreApplication.instance().desktop()
screen_height = desktop.availableGeometry().height() - 100
self.resize(self.size().width(), screen_height)
示例2: __init__
# 需要导入模块: from PyQt4.Qt import QCoreApplication [as 别名]
# 或者: from PyQt4.Qt.QCoreApplication import instance [as 别名]
def __init__(self, *args, **kwargs):
QDialog.__init__(self, *args)
self.setupUi(self)
desktop = QCoreApplication.instance().desktop()
geom = desktop.availableGeometry(self)
nh, nw = geom.height()-25, geom.width()-10
if nh < 0:
nh = max(800, self.height())
if nw < 0:
nw = max(600, self.height())
nh = min(self.height(), nh)
nw = min(self.width(), nw)
self.resize(nw, nh)
示例3: config_widget
# 需要导入模块: from PyQt4.Qt import QCoreApplication [as 别名]
# 或者: from PyQt4.Qt.QCoreApplication import instance [as 别名]
def config_widget(cls):
from PyQt4.Qt import QCoreApplication
from PyQt4.Qt import QScrollArea
cw = super(KOBOTOUCHEXTENDED, cls).config_widget()
qsa = QScrollArea()
qsa.setWidgetResizable(True)
qsa.setWidget(cw)
qsa.validate = cw.validate
desktop_geom = QCoreApplication.instance().desktop().availableGeometry()
if desktop_geom.height() < 800:
qsa.setBaseSize(qsa.size().width(), desktop_geom.height() - 100)
return qsa
示例4: __init__
# 需要导入模块: from PyQt4.Qt import QCoreApplication [as 别名]
# 或者: from PyQt4.Qt.QCoreApplication import instance [as 别名]
def __init__(self, *args):
SurfacePlot.__init__(self, *args)
# fonts
family = QCoreApplication.instance().font().family()
if 'Verdana' in QFontDatabase().families():
family = 'Verdana'
family = 'Courier'
self.coordinates().setLabelFont(family, 14)
self.coordinates().setNumberFont(family, 12)
self.setTitle('A Simple SurfacePlot Demonstration');
self.setTitleFont(family, 16, QFont.Bold)
self.setBackgroundColor(RGBA(1.0, 1.0, 0.6))
rosenbrock = Rosenbrock(self)
rosenbrock.setMesh(41, 31)
rosenbrock.setDomain(-1.73, 1.5, -1.5, 1.5)
rosenbrock.setMinZ(-10)
rosenbrock.create()
self.setRotation(30, 0, 15)
self.setScale(1, 1, 1)
self.setShift(0.15, 0, 0)
self.setZoom(0.9)
axes = self.coordinates().axes # alias
for axis in axes:
axis.setMajors(7)
axis.setMinors(4)
axes[X1].setLabelString('x-axis')
axes[Y1].setLabelString('y-axis')
axes[Z1].setLabelString('z-axis')
self.setCoordinateStyle(BOX);
self.updateData();
self.updateGL();
示例5: __init__
# 需要导入模块: from PyQt4.Qt import QCoreApplication [as 别名]
# 或者: from PyQt4.Qt.QCoreApplication import instance [as 别名]
def __init__(self, parent, updateinterval):
SurfacePlot.__init__(self, parent)
# fonts
family = QCoreApplication.instance().font().family()
if 'Verdana' in QFontDatabase().families():
family = 'Verdana'
family = 'Courier'
self.setTitleFont(family, 16, QFont.Bold)
self.setRotation(30, 0, 15)
self.setShift(0.1, 0, 0)
self.setZoom(0.8)
self.coordinates().setNumberFont(family, 8)
axes = self.coordinates().axes # alias
for axis in axes:
axis.setMajors(7)
axis.setMinors(4)
axes[X1].setLabelString("x")
axes[Y1].setLabelString("y")
axes[Z1].setLabelString("z")
axes[X2].setLabelString("x")
axes[Y2].setLabelString("y")
axes[Z2].setLabelString("z")
axes[X3].setLabelString("x")
axes[Y3].setLabelString("y")
axes[Z3].setLabelString("z")
axes[X4].setLabelString("x")
axes[Y4].setLabelString("y")
axes[Z4].setLabelString("z")
timer = QTimer(self)
self.connect(timer, SIGNAL('timeout()'), self.rotate)
timer.start(updateinterval)
示例6: available_width
# 需要导入模块: from PyQt4.Qt import QCoreApplication [as 别名]
# 或者: from PyQt4.Qt.QCoreApplication import instance [as 别名]
def available_width():
desktop = QCoreApplication.instance().desktop()
return desktop.availableGeometry().width()
示例7: available_height
# 需要导入模块: from PyQt4.Qt import QCoreApplication [as 别名]
# 或者: from PyQt4.Qt.QCoreApplication import instance [as 别名]
def available_height():
desktop = QCoreApplication.instance().desktop()
return desktop.availableGeometry().height()
示例8: available_heights
# 需要导入模块: from PyQt4.Qt import QCoreApplication [as 别名]
# 或者: from PyQt4.Qt.QCoreApplication import instance [as 别名]
def available_heights():
desktop = QCoreApplication.instance().desktop()
return map(lambda x: x.height(), map(desktop.availableGeometry, range(desktop.numScreens())))
示例9: no_more_jobs
# 需要导入模块: from PyQt4.Qt import QCoreApplication [as 别名]
# 或者: from PyQt4.Qt.QCoreApplication import instance [as 别名]
def no_more_jobs(self):
if self.is_running:
self.stop()
QCoreApplication.instance().alert(self, 5000)
示例10: __init__
# 需要导入模块: from PyQt4.Qt import QCoreApplication [as 别名]
# 或者: from PyQt4.Qt.QCoreApplication import instance [as 别名]
def __init__(self, parent, view, row, link_delegate):
QDialog.__init__(self, parent)
self.normal_brush = QBrush(Qt.white)
self.marked_brush = QBrush(Qt.lightGray)
self.marked = None
self.gui = parent
self.splitter = QSplitter(self)
self._l = l = QVBoxLayout(self)
self.setLayout(l)
l.addWidget(self.splitter)
self.cover = CoverView(self)
self.cover.resizeEvent = self.cover_view_resized
self.cover.cover_changed.connect(self.cover_changed)
self.cover_pixmap = None
self.cover.sizeHint = self.details_size_hint
self.splitter.addWidget(self.cover)
self.details = QWebView(self)
self.details.sizeHint = self.details_size_hint
self.details.page().setLinkDelegationPolicy(self.details.page().DelegateAllLinks)
self.details.linkClicked.connect(self.link_clicked)
s = self.details.page().settings()
s.setAttribute(s.JavascriptEnabled, False)
self.css = css()
self.link_delegate = link_delegate
self.details.setAttribute(Qt.WA_OpaquePaintEvent, False)
palette = self.details.palette()
self.details.setAcceptDrops(False)
palette.setBrush(QPalette.Base, Qt.transparent)
self.details.page().setPalette(palette)
self.c = QWidget(self)
self.c.l = l2 = QGridLayout(self.c)
self.c.setLayout(l2)
l2.addWidget(self.details, 0, 0, 1, -1)
self.splitter.addWidget(self.c)
self.fit_cover = QCheckBox(_('Fit &cover within view'), self)
self.fit_cover.setChecked(gprefs.get('book_info_dialog_fit_cover', True))
l2.addWidget(self.fit_cover, l2.rowCount(), 0, 1, -1)
self.previous_button = QPushButton(QIcon(I('previous.png')), _('&Previous'), self)
self.previous_button.clicked.connect(self.previous)
l2.addWidget(self.previous_button, l2.rowCount(), 0)
self.next_button = QPushButton(QIcon(I('next.png')), _('&Next'), self)
self.next_button.clicked.connect(self.next)
l2.addWidget(self.next_button, l2.rowCount() - 1, 1)
self.view = view
self.current_row = None
self.refresh(row)
self.view.selectionModel().currentChanged.connect(self.slave)
self.fit_cover.stateChanged.connect(self.toggle_cover_fit)
self.ns = QShortcut(QKeySequence('Alt+Right'), self)
self.ns.activated.connect(self.next)
self.ps = QShortcut(QKeySequence('Alt+Left'), self)
self.ps.activated.connect(self.previous)
self.next_button.setToolTip(_('Next [%s]')%
unicode(self.ns.key().toString(QKeySequence.NativeText)))
self.previous_button.setToolTip(_('Previous [%s]')%
unicode(self.ps.key().toString(QKeySequence.NativeText)))
geom = QCoreApplication.instance().desktop().availableGeometry(self)
screen_height = geom.height() - 100
screen_width = geom.width() - 100
self.resize(max(int(screen_width/2), 700), screen_height)
saved_layout = gprefs.get('book_info_dialog_layout', None)
if saved_layout is not None:
try:
self.restoreGeometry(saved_layout[0])
self.splitter.restoreState(saved_layout[1])
except Exception:
pass
示例11: __init__
# 需要导入模块: from PyQt4.Qt import QCoreApplication [as 别名]
# 或者: from PyQt4.Qt.QCoreApplication import instance [as 别名]
def __init__(self, gui, view, row):
QDialog.__init__(self, gui, flags=Qt.Window)
Ui_Quickview.__init__(self)
self.setupUi(self)
self.isClosed = False
self.books_table_column_widths = None
try:
self.books_table_column_widths = gprefs.get("quickview_dialog_books_table_widths", None)
geom = gprefs.get("quickview_dialog_geometry", bytearray(""))
self.restoreGeometry(QByteArray(geom))
except:
pass
# Remove the help button from the window title bar
icon = self.windowIcon()
self.setWindowFlags(self.windowFlags() & (~Qt.WindowContextHelpButtonHint))
self.setWindowFlags(self.windowFlags() | Qt.WindowStaysOnTopHint)
self.setWindowIcon(icon)
self.db = view.model().db
self.view = view
self.gui = gui
self.is_closed = False
self.current_book_id = None
self.current_key = None
self.last_search = None
self.current_column = None
self.current_item = None
self.no_valid_items = False
column_positions = self.view.get_state()["column_positions"]
column_order = ["title", "authors", "series"]
column_order.sort(key=lambda col: column_positions[col])
self.title_column = column_order.index("title")
self.author_column = column_order.index("authors")
self.series_column = column_order.index("series")
self.items.setSelectionMode(QAbstractItemView.SingleSelection)
self.items.currentTextChanged.connect(self.item_selected)
# Set up the books table columns
self.books_table.setSelectionBehavior(QAbstractItemView.SelectRows)
self.books_table.setSelectionMode(QAbstractItemView.SingleSelection)
self.books_table.setColumnCount(3)
t = QTableWidgetItem(_("Title"))
self.books_table.setHorizontalHeaderItem(self.title_column, t)
t = QTableWidgetItem(_("Authors"))
self.books_table.setHorizontalHeaderItem(self.author_column, t)
t = QTableWidgetItem(_("Series"))
self.books_table.setHorizontalHeaderItem(self.series_column, t)
self.books_table_header_height = self.books_table.height()
self.books_table.cellDoubleClicked.connect(self.book_doubleclicked)
self.books_table.sortByColumn(self.title_column, Qt.AscendingOrder)
# get the standard table row height. Do this here because calling
# resizeRowsToContents can word wrap long cell contents, creating
# double-high rows
self.books_table.setRowCount(1)
self.books_table.setItem(0, 0, TableItem("A", ""))
self.books_table.resizeRowsToContents()
self.books_table_row_height = self.books_table.rowHeight(0)
self.books_table.setRowCount(0)
# Add the data
self.refresh(row)
self.view.clicked.connect(self.slave)
self.change_quickview_column.connect(self.slave)
QCoreApplication.instance().aboutToQuit.connect(self.save_state)
self.search_button.clicked.connect(self.do_search)
view.model().new_bookdisplay_data.connect(self.book_was_changed)
close_button = self.buttonBox.button(QDialogButtonBox.Close)
close_button.setAutoDefault(False)
示例12: QApplication
# 需要导入模块: from PyQt4.Qt import QCoreApplication [as 别名]
# 或者: from PyQt4.Qt.QCoreApplication import instance [as 别名]
"""iqt
Provides control over PyQt and PyQwt widgets from the command line interpreter.
"""
# Import GNU readline, so that readline can do its work in Python scripts.
# _iqt falls back on a different method when there is no GNU readline.
try:
import readline
except ImportError:
pass
from PyQt4.Qt import QApplication, QCoreApplication, PYQT_VERSION
if QCoreApplication.instance() is None:
_a = QApplication([])
if PYQT_VERSION < 0x40300:
import _iqt
# Local Variables: ***
# mode: python ***
# End: ***
示例13: __init__
# 需要导入模块: from PyQt4.Qt import QCoreApplication [as 别名]
# 或者: from PyQt4.Qt.QCoreApplication import instance [as 别名]
def __init__(self, gui, view, row):
QDialog.__init__(self, gui, flags=Qt.Window)
Ui_Quickview.__init__(self)
self.setupUi(self)
self.isClosed = False
self.books_table_column_widths = None
try:
self.books_table_column_widths = \
gprefs.get('quickview_dialog_books_table_widths', None)
geom = gprefs.get('quickview_dialog_geometry', bytearray(''))
self.restoreGeometry(QByteArray(geom))
except:
pass
# Remove the help button from the window title bar
icon = self.windowIcon()
self.setWindowFlags(self.windowFlags()&(~Qt.WindowContextHelpButtonHint))
self.setWindowIcon(icon)
self.db = view.model().db
self.view = view
self.gui = gui
self.is_closed = False
self.current_book_id = None
self.current_key = None
self.last_search = None
self.current_column = None
self.current_item = None
self.no_valid_items = False
self.items.setSelectionMode(QAbstractItemView.SingleSelection)
self.items.currentTextChanged.connect(self.item_selected)
# Set up the books table columns
self.books_table.setSelectionBehavior(QAbstractItemView.SelectRows)
self.books_table.setSelectionMode(QAbstractItemView.SingleSelection)
self.books_table.setColumnCount(3)
t = QTableWidgetItem(_('Title'))
self.books_table.setHorizontalHeaderItem(0, t)
t = QTableWidgetItem(_('Authors'))
self.books_table.setHorizontalHeaderItem(1, t)
t = QTableWidgetItem(_('Series'))
self.books_table.setHorizontalHeaderItem(2, t)
self.books_table_header_height = self.books_table.height()
self.books_table.cellDoubleClicked.connect(self.book_doubleclicked)
self.books_table.sortByColumn(0, Qt.AscendingOrder)
# get the standard table row height. Do this here because calling
# resizeRowsToContents can word wrap long cell contents, creating
# double-high rows
self.books_table.setRowCount(1)
self.books_table.setItem(0, 0, TableItem('A', ''))
self.books_table.resizeRowsToContents()
self.books_table_row_height = self.books_table.rowHeight(0)
self.books_table.setRowCount(0)
# Add the data
self.refresh(row)
self.view.clicked.connect(self.slave)
QCoreApplication.instance().aboutToQuit.connect(self.save_state)
self.search_button.clicked.connect(self.do_search)
view.model().new_bookdisplay_data.connect(self.book_was_changed)