Created
January 26, 2014 23:17
-
-
Save anonymous/8640773 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import sys, repl | |
from PySide import QtCore, QtGui | |
from ui_mvctest import Ui_dialog | |
from repl import Read, Eval | |
class View(QtGui.QWidget): | |
def __init__(self, parent = None): | |
# GUI部品の初期化 | |
super(View, self).__init__(parent) | |
self.ui = Ui_dialog() | |
self.ui.setupUi(self) | |
self.initUI() | |
# 環境保持 | |
self.env = 0 | |
self.c = Controller() # Controller のインスタンスを持つ | |
def initUI(self): | |
self.show() # 本当はここに置かなくても構わない | |
def buttonClicked(self): # Button が click() された時に結ばれてるスロット | |
sender = self.sender() # これがシグナル | |
x, env = self.c.parse(sender.text(), self.env) # シグナルの中身のテキストと、環境 env を Controller の parse メソッドに渡す | |
self.ui.lcdNumber.display(x) # LCDNumber は display メソッドで表示する | |
self.env = env # インスタンス変数 env を書き換えておく |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment