本文整理汇总了Python中View.View类的典型用法代码示例。如果您正苦于以下问题:Python View类的具体用法?Python View怎么用?Python View使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了View类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, style=STYLE_DEFAULT, fixed_size=None):
View.__init__(self)
self._window = self
self._first_responder = None
self._title = None
self._style = style
self._resizable = fixed_size is None
self._application = Application.shared_application()
self._min_size = None
self._max_size = None
self._zoomed = False
self._key_window = False
self._main_window = False
if fixed_size is None:
# normal window
self._pyglet = PygletWindow(self,
style=style,
resizable=True)
else:
# fixed size window
self._pyglet = PygletWindow(self,
style=style,
resizable=False,
width=fixed_size.width,
height=fixed_size.height)
x, y = self._pyglet.get_location()
width, height = self._pyglet.get_size()
View.set_frame(self, Rect(x, y, width, height))
self._application._add_window(self)
示例2: set_frame
def set_frame(self, rect):
if ( self._resizable == False
and (rect.size.width != None or rect.size.height != None)):
raise ValueError(u'Window is not resizable')
View.set_frame(self, rect)
self._pyglet.set_location(self._frame.origin.x, self._frame.origin.y)
self._pyglet.set_size(self._frame.size.width, self._frame.size.height)
示例3: export_print_page
def export_print_page(self, event):
"""Export a print page using a JSON file"""
event.Skip()
if self.view.image is not None:
# We don't require an RMAP file, just rect data that we can generate
dlg = wx.FileDialog(self, "Choose a JSON file to load", "", "", "", wx.SAVE)
if dlg.ShowModal() == wx.ID_OK:
filename = dlg.GetFilename()
dirname = dlg.GetDirectory()
dlg.Destroy()
else:
self.SetStatusText(Preferences.failedToOpen)
return False
rmap_data = self.view.rects
try:
with open(join(dirname, filename), "r") as f:
json_data = loads(f.read())
except Exception as e:
self.SetStatusText(Preferences.failedToExport)
return False
fd = self.img.split(".")
fd.pop()
fname = ".".join(fd)
rmap_data = View.filter_list(rmap_data)
rmap_data = View.clean_list(rmap_data)
rmap_data = View.generate_data(rmap_data)
self.write_html_printpage(self.filename, fname, rmap_data, json_data)
else:
self.SetStatusText(Preferences.noImageLoaded)
示例4: __init__
def __init__(self):
View.__init__(self)
self._state = Control.STATE_NORMAL
self._attrs = {}
for k, v in ControlState:
self._attrs[k] = None
self._actions = {}
示例5: __init__
def __init__(self, controller, parentXYView):
View.__init__(self, controller)
self._mplAxes = None
self._mplLines = None
self._isHighlighted = False
self._initialLineWidth = None
self._parentXYView = parentXYView
self._marker = None
self._color = None
self._lineStyle = None
示例6: __init__
def __init__( self, controller) :
""" Constructor """
View.__init__( self, controller)
CurveTreeDockWidget.__init__(self)
self._noUpdate = False
treeWidget = self.getTreeWidget()
treeWidget.itemSelectionChanged.connect(self.onItemSelectionChanged)
treeWidget.itemDoubleClicked.connect(self.onItemDoubleCliked)
treeWidget.setContextMenuPolicy(Qt.CustomContextMenu)
treeWidget.customContextMenuRequested.connect(self.openMenu)
示例7: main
def main(args) :
"""Fonction principal qui va nous lancer notre annuaire"""
#bdd = sqlite3.connect('Bdd/patron.db')
app=QApplication(args)
control = Control()
model = Model(control)
fenetre = View(control);
fenetre.show();
#bdd.close()
return app.exec_()
示例8: __init__
def __init__(self, path):
self.myModel = Model(Filer(), Validator())
if path != "" or path is not None:
self.load_data(path)
self.myView = View(self)
self.myModel.pickle_data()
self.myView.cmdloop()
示例9: __init__
def __init__(self, path):
self.myModel = Model()
if path != "" or path is not None:
self.load_data(path)
self.myView = View(self)
self.myModel.data_handler.load_pickle_data()
self.myView.cmdloop()
示例10: __init__
def __init__(self):
self.model = Model()
self.view = View()
self.firstTime = True
self.result = 0.0
self.a = 0.0
self.b = 0.0
self.usePrev = 0
示例11: Controller
class Controller(object):
def __init__(self):
self.model = Model()
self.view = View()
def run(self):
name = self.view.welcome()
if name == 'Ken':
print(self.model.say_hello(name))
else:
print(self.model.say_bye())
示例12: __init__
class Game:
def __init__(self):
self.board = Board()
self.evaluation = Evaluation(self.board)
self.view = View(self.board)
def __finish(self, computerPlayer):
if self.evaluation.winner() == computerPlayer:
print "Computer player wins"
elif self.evaluation.isTie():
print "Tie game"
else:
print "Human player wins"
def run(self):
startPlayer = self.view.inputStartPlayer()
computerPlayer = 'X' if startPlayer == 2 else 'O'
ai = AI(computerPlayer, self.board)
while self.evaluation.winner() == None and not self.evaluation.isTie():
self.view.displayBoard()
if self.board.getPlayer() == computerPlayer:
ai.makeMove()
else:
move = self.view.inputMove()
self.board.move(move)
self.view.displayBoard()
self.__finish(computerPlayer)
示例13: run
def run(self):
self.rows,self.lines = View.GreatingMessage()
self.NamesOfPlayers,View.NumberOfPlayers = View.NamesOfPlayers() # intial Players from View
for name in self.NamesOfPlayers:
player = Controller.Player(name)
self.Players.append(player)
self.Turner = Controller.Turner(self.Players)
View.Symbols = View.GenerateSymbols(View.NumberOfPlayers)
View.tablePrint(self.rows,self.lines,[])
Win = False
while not Win:
CurentPlayer = self.Turner.getNext()
print "Hello ", CurentPlayer.getName()
x,y = View.InputMessage()
if not self.ValidCoordinate((x,y)):
print "continue"
self.Turner.CurentState = self.Turner.CurentState - 1
continue
self.Model.setCordinate(CurentPlayer,(x,y))
mapp = self.Model.getMappingNotLinear()
View.tablePrint(self.lines,self.rows,mapp)
Win = self.is_win(CurentPlayer,(x,y))
pass
View.WinMessage(Winner=self.Winner)
示例14: __init__
def __init__(self, controller):
View.__init__(self, controller)
self._eventHandler = EventHandler()
self._curveViews = {} # key: curve (model) ID, value: CurveView
self._salomeViewID = None
self._mplFigure = None
self._mplAxes = None
self._mplCanvas = None
self._plotWidget = None
self._sgPyQt = self._controller._sgPyQt
self._toolbar = None
self._mplNavigationActions = {}
self._toobarMPL = None
self._grid = None
self._currCrv = None # current curve selected in the view
self._legend = None
self._legendLoc = "right" # "right" or "bottom"
self._fitArea = False
self._zoomPan = False
self._dragOnDrop = False
self._move = False
self._patch = None
self._xdata = None
self._ydata = None
self._defaultLineStyle = None
self._last_point = None
self._lastMarkerID = -1
self._blockLogSignal = False
self._axisXSciNotation = False
self._axisYSciNotation = False
self._prevTitle = None
示例15: __init__
def __init__(self, app):
# initialize the model and view
# * The model handles all the data, and signal-related operations
# * The view handles all the data visualization
self.model = Model()
self.view = View()
# subscribe to messages sent by the view
pub.subscribe(self.parse_file, "FILE PATH CHANGED")
pub.subscribe(self.reprocess_fft, "FFT CONTROLS CHANGED")
# subscribe to messages sent by the model
pub.subscribe(self.signal_changed, "SIGNAL CHANGED")
pub.subscribe(self.signal_changed, "FFT CHANGED")
self.view.Show()