本文整理汇总了Python中constants.Constants.open_prop方法的典型用法代码示例。如果您正苦于以下问题:Python Constants.open_prop方法的具体用法?Python Constants.open_prop怎么用?Python Constants.open_prop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类constants.Constants
的用法示例。
在下文中一共展示了Constants.open_prop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AppWindow
# 需要导入模块: from constants import Constants [as 别名]
# 或者: from constants.Constants import open_prop [as 别名]
class AppWindow(QtGui.QMainWindow):
"""This is the main application window displaying the shaft
geometries and relevant safety factors. A toolbar allows the
user to load & save files, edit the configuration, and alter views.
"""
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
self.setWindowTitle("Wind Turbine Shaft Analysis")
self.setFixedSize(1280,720)
self.create_actions()
self.create_menu()
# Setup the main application.
self.main_widget = QtGui.QWidget(self)
self.layout = QtGui.QVBoxLayout(self.main_widget)
self.main_widget.setFocus()
self.setCentralWidget(self.main_widget)
# Initialize constants and statuses of the application.
self.init_values()
# Update the main window with solutions.
self.update_solution()
# Tell the user what files are still required.
self.update_status()
def init_values(self):
"""Initialize statuses of whether or not files have been
loaded, whether shaft information displays are normalized,
and whether or not the plot needs to be refreshed. Also
initialize a class holding constants.
"""
# Holds the states of whether the necessary files have been loaded.
# The 4 required files are:
# - designs specifications
# - material properties
# - load factors
# - wind history.
self.loaded = [False, False, False, False]
# This value determines how details of the shaft sections are displayed.
# A value of 'True' scales text uniformly; A value of 'False' places
# text underneath plotted shaft sections.
self.normalized = False
# This value determines whether solutions have to be (re)solved.
# Prevents recalculating solutions if user only wants to change views.
self.reload = True
# Initialize constants.
self.c = Constants()
def create_actions(self):
"""Create menu actions."""
# File Menu Actions
self.act_obt_design = QtGui.QAction('Obtain Design', self,
shortcut='Ctrl+1', triggered=self.open_design)
self.act_obt_prop = QtGui.QAction('Obtain Material Properties', self,
shortcut='Ctrl+2', triggered=self.open_prop)
self.act_obt_load = QtGui.QAction('Obtain Load Factors', self,
shortcut='Ctrl+3', triggered=self.open_load)
self.act_obt_wind = QtGui.QAction('Obtain Wind History', self,
shortcut='Ctrl+4', triggered=self.open_wind)
self.act_save_design = QtGui.QAction('Save Design', self,
shortcut='Ctrl+S', triggered=self.save_design)
self.act_quit = QtGui.QAction('Quit', self,
shortcut='Ctrl+Q', triggered=self.quit_file)
# Edit Menu Actions
self.act_edit_design = QtGui.QAction('Edit Design', self,
shortcut='Ctrl+E', triggered=self.edit_design)
# View Menu Actions
self.act_normalize_view = QtGui.QAction('Normalize View', self,
shortcut='Ctrl+V', checkable=True,
triggered=self.normalize_view)
self.act_normalize_view.setStatusTip('Uniformly reposition shaft '
'information. The order of information still '
'corresponds to the order of shaft sections '
'i.e. the first set of information corresponds'
' to section 1, the second to section 2, etc.')
# Help Menu Actions
self.act_about = QtGui.QAction('About', self,
shortcut='Ctrl+A', triggered=self.about)
def create_menu(self):
"""Create the application menu with File, Edit, View, Help
and About tabs.
"""
file_menu = QtGui.QMenu('File', self)
file_menu.addAction(self.act_obt_design)
file_menu.addAction(self.act_obt_prop)
file_menu.addAction(self.act_obt_load)
file_menu.addAction(self.act_obt_wind)
file_menu.addSeparator()
file_menu.addAction(self.act_save_design)
#.........这里部分代码省略.........