本文整理汇总了Python中PyQt4.QtDeclarative.QDeclarativeView.setMinimumWidth方法的典型用法代码示例。如果您正苦于以下问题:Python QDeclarativeView.setMinimumWidth方法的具体用法?Python QDeclarativeView.setMinimumWidth怎么用?Python QDeclarativeView.setMinimumWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtDeclarative.QDeclarativeView
的用法示例。
在下文中一共展示了QDeclarativeView.setMinimumWidth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PluginsStore
# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import setMinimumWidth [as 别名]
class PluginsStore(QDialog):
def __init__(self, parent=None):
super(PluginsStore, self).__init__(parent, Qt.Dialog)
vbox = QVBoxLayout(self)
vbox.setContentsMargins(0, 0, 0, 0)
vbox.setSpacing(0)
self.view = QDeclarativeView()
self.view.setMinimumWidth(800)
self.view.setMinimumHeight(600)
self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
self.view.setSource(ui_tools.get_qml_resource("PluginsStore.qml"))
self.root = self.view.rootObject()
vbox.addWidget(self.view)
self.nenv = nenvironment.NenvEggSearcher()
self.connect(self.nenv, SIGNAL("searchCompleted(PyQt_PyObject)"),
self.callback)
self.status = self.nenv.do_search()
def callback(self, values):
for each_val in values:
print each_val
示例2: PluginsStore
# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import setMinimumWidth [as 别名]
class PluginsStore(QDialog):
def __init__(self, parent=None):
super(PluginsStore, self).__init__(parent, Qt.Dialog)
self.setWindowTitle(translations.TR_MANAGE_PLUGINS)
vbox = QVBoxLayout(self)
vbox.setContentsMargins(0, 0, 0, 0)
vbox.setSpacing(0)
self.view = QDeclarativeView()
self.view.setMinimumWidth(800)
self.view.setMinimumHeight(600)
self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
self.view.setSource(ui_tools.get_qml_resource("PluginsStore.qml"))
self.root = self.view.rootObject()
vbox.addWidget(self.view)
self._plugins = {}
self._plugins_inflate = []
self._plugins_by_tag = collections.defaultdict(list)
self._plugins_by_author = collections.defaultdict(list)
self._base_color = QColor("white")
self._counter = 0
self._counter_callback = None
self._inflating_plugins = []
self._categoryTags = True
self._search = []
self.status = None
self.connect(self.root, SIGNAL("loadPluginsGrid()"),
self._load_by_name)
self.connect(self.root, SIGNAL("showPluginDetails(int)"),
self.show_plugin_details)
self.connect(self.root, SIGNAL("loadTagsGrid()"),
self._load_tags_grid)
self.connect(self.root, SIGNAL("loadAuthorGrid()"),
self._load_author_grid)
self.connect(self.root, SIGNAL("search(QString)"),
self._load_search_results)
self.connect(self.root, SIGNAL("loadPluginsForCategory(QString)"),
self._load_plugins_for_category)
self.connect(self, SIGNAL("processCompleted(PyQt_PyObject)"),
self._process_complete)
self.nenv = nenvironment.NenvEggSearcher()
self.connect(self.nenv,
SIGNAL("searchCompleted(PyQt_PyObject)"),
self.callback)
self.status = self.nenv.do_search()
def _load_by_name(self):
if self._plugins:
self.root.showGridPlugins()
for plugin in list(self._plugins.values()):
self.root.addPlugin(plugin.identifier, plugin.name,
plugin.summary, plugin.version)
def _load_plugins_for_category(self, name):
self.root.showGridPlugins()
if self._categoryTags:
for plugin in self._plugins_by_tag[name]:
self.root.addPlugin(plugin.identifier, plugin.name,
plugin.summary, plugin.version)
else:
for plugin in self._plugins_by_author[name]:
self.root.addPlugin(plugin.identifier, plugin.name,
plugin.summary, plugin.version)
def callback(self, values):
self.root.showGridPlugins()
for i, plugin in enumerate(values):
plugin.identifier = i + 1
self.root.addPlugin(plugin.identifier, plugin.name,
plugin.summary, plugin.version)
self._plugins[plugin.identifier] = plugin
def show_plugin_details(self, identifier):
plugin = self._plugins[identifier]
self._counter = 1
self._counter_callback = self._show_details
if plugin.shallow:
self.connect(plugin,
SIGNAL("pluginMetadataInflated(PyQt_PyObject)"),
self._update_content)
self._plugins_inflate.append(plugin.inflate())
else:
self._update_content(plugin)
def _load_tags_grid(self):
self._categoryTags = True
self._counter = len(self._plugins)
self.root.updateCategoryCounter(self._counter)
self._counter_callback = self._show_tags_grid
self._inflating_plugins = list(self._plugins.values())
self._loading_function()
def _load_author_grid(self):
self._categoryTags = False
self._counter = len(self._plugins)
self.root.updateCategoryCounter(self._counter)
self._counter_callback = self._show_author_grid
#.........这里部分代码省略.........
示例3: StartPage
# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import setMinimumWidth [as 别名]
class StartPage(QWidget):
def __init__(self, parent=None):
super(StartPage, self).__init__(parent)
vbox = QVBoxLayout(self)
vbox.setContentsMargins(0, 0, 0, 0)
vbox.setSpacing(0)
self.view = QDeclarativeView()
self.view.setMinimumWidth(400)
self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
self.view.setSource(ui_tools.get_qml_resource("StartPage.qml"))
self.root = self.view.rootObject()
vbox.addWidget(self.view)
self.load_items()
self.connect(self.root, SIGNAL("openProject(QString)"),
self._open_project)
self.connect(self.root, SIGNAL("removeProject(QString)"),
self._on_click_on_delete)
self.connect(self.root, SIGNAL("markAsFavorite(QString, bool)"),
self._on_click_on_favorite)
self.connect(self.root, SIGNAL("openPreferences()"),
lambda: self.emit(SIGNAL("openPreferences()")))
self.connect(self.root, SIGNAL("newFile()"),
lambda: self.emit(SIGNAL("newFile()")))
self.root.set_year(str(datetime.datetime.now().year))
def _open_project(self, path):
projects_explorer = IDE.get_service('projects_explorer')
if projects_explorer:
projects_explorer.open_project_folder(path)
def _on_click_on_delete(self, path):
settings = IDE.data_settings()
recent_projects = settings.value("recentProjects")
if path in recent_projects:
del recent_projects[path]
settings.setValue("recentProjects", recent_projects)
def _on_click_on_favorite(self, path, value):
settings = IDE.data_settings()
recent_projects = settings.value("recentProjects")
properties = recent_projects[path]
properties["isFavorite"] = value
recent_projects[path] = properties
settings.setValue("recentProjects", recent_projects)
def load_items(self):
settings = IDE.data_settings()
listByFavorites = []
listNoneFavorites = []
recent_projects_dict = dict(settings.value('recentProjects', {}))
#Filter for favorites
for recent_project_path, content in list(recent_projects_dict.items()):
if bool(dict(content)["isFavorite"]):
listByFavorites.append((recent_project_path,
content["lastopen"]))
else:
listNoneFavorites.append((recent_project_path,
content["lastopen"]))
if len(listByFavorites) > 1:
# sort by date favorites
listByFavorites = sorted(listByFavorites,
key=lambda date: listByFavorites[1])
if len(listNoneFavorites) > 1:
#sort by date last used
listNoneFavorites = sorted(listNoneFavorites,
key=lambda date: listNoneFavorites[1])
for recent_project_path in listByFavorites:
path = recent_project_path[0]
name = recent_projects_dict[path]['name']
self.root.add_project(name, path, True)
for recent_project_path in listNoneFavorites:
path = recent_project_path[0]
name = recent_projects_dict[path]['name']
self.root.add_project(name, path, False)
self.root.forceActiveFocus()
示例4: StartPage
# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import setMinimumWidth [as 别名]
class StartPage(QWidget, itab_item.ITabItem):
def __init__(self, parent=None):
super(StartPage, self).__init__(parent)
self._id = "Start Page"
vbox = QVBoxLayout(self)
self.view = QDeclarativeView()
self.view.setMinimumWidth(400)
self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
path_qml = QDir.fromNativeSeparators(
os.path.join(resources.QML_FILES, "StartPage.qml"))
path_qml = urlunparse(urlparse(path_qml)._replace(scheme='file'))
self.view.setSource(QUrl(path_qml))
self.root = self.view.rootObject()
vbox.addWidget(self.view)
self.load_items()
self.connect(self.root, SIGNAL("openProject(QString)"),
self._open_project)
self.connect(self.root, SIGNAL("removeProject(QString)"),
self._on_click_on_delete)
self.connect(self.root, SIGNAL("markAsFavorite(QString, bool)"),
self._on_click_on_favorite)
self.connect(self.root, SIGNAL("openPreferences()"),
lambda: self.emit(SIGNAL("openPreferences()")))
def _open_project(self, path):
self.emit(SIGNAL("openProject(QString)"), path)
def _on_click_on_delete(self, path):
settings = QSettings(resources.SETTINGS_PATH, QSettings.IniFormat)
recent_projects = settings.value("recentProjects")
if path in recent_projects:
del recent_projects[path]
settings.setValue("recentProjects", recent_projects)
def _on_click_on_favorite(self, path, value):
settings = QSettings(resources.SETTINGS_PATH, QSettings.IniFormat)
recent_projects = settings.value("recentProjects")
properties = recent_projects[path]
properties["isFavorite"] = value
recent_projects[path] = properties
settings.setValue("recentProjects", recent_projects)
def load_items(self):
settings = QSettings(resources.SETTINGS_PATH, QSettings.IniFormat)
listByFavorites = []
listNoneFavorites = []
recent_projects_dict = dict(settings.value('recentProjects', {}))
#Filter for favorites
for recent_project_path, content in list(recent_projects_dict.items()):
if bool(dict(content)["isFavorite"]):
listByFavorites.append((recent_project_path,
content["lastopen"]))
else:
listNoneFavorites.append((recent_project_path,
content["lastopen"]))
if len(listByFavorites) > 1:
# sort by date favorites
listByFavorites = sorted(listByFavorites,
key=lambda date: listByFavorites[1])
if len(listNoneFavorites) > 1:
#sort by date last used
listNoneFavorites = sorted(listNoneFavorites,
key=lambda date: listNoneFavorites[1])
for recent_project_path in listByFavorites:
path = recent_project_path[0]
name = recent_projects_dict[path]['name']
self.root.add_project(name, path, True)
for recent_project_path in listNoneFavorites:
path = recent_project_path[0]
name = recent_projects_dict[path]['name']
self.root.add_project(name, path, False)