# Path: ui_nonstop.py
# class Ui_Nonstop(object):
#     def setupUi(self, Nonstop):
#         Nonstop.setObjectName(_fromUtf8("Nonstop"))
#         Nonstop.resize(498, 311)
#         Nonstop.setMinimumSize(QtCore.QSize(498, 311))
#         Nonstop.setMaximumSize(QtCore.QSize(498, 311))
#         Nonstop.setWindowTitle(QtGui.QApplication.translate("Nonstop", "Nonstop Debate Viewer", None, QtGui.QApplication.UnicodeUTF8))
#         icon = QtGui.QIcon()
#         icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/monokuma.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
#         Nonstop.setWindowIcon(icon)
#         self.buttonBox = QtGui.QDialogButtonBox(Nonstop)
#         self.buttonBox.setGeometry(QtCore.QRect(339, 280, 151, 31))
#         self.buttonBox.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
#         self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
#         self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
#         self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
#         self.lblPreview = QtGui.QLabel(Nonstop)
#         self.lblPreview.setGeometry(QtCore.QRect(9, 9, 480, 272))
#         self.lblPreview.setFrameShape(QtGui.QFrame.StyledPanel)
#         self.lblPreview.setFrameShadow(QtGui.QFrame.Sunken)
#         self.lblPreview.setText(_fromUtf8(""))
#         self.lblPreview.setObjectName(_fromUtf8("lblPreview"))
# 
#         self.retranslateUi(Nonstop)
#         QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), Nonstop.accept)
#         QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), Nonstop.reject)
#         QtCore.QMetaObject.connectSlotsByName(Nonstop)
# 
#     def retranslateUi(self, Nonstop):
#         pass


from PyQt4 import QtCore, QtGui, Qt
from PyQt4.QtGui import QImage, QPainter, QColor, QLabel, QMatrix
from PyQt4.QtCore import QRect, QRectF
from ui_nonstop import Ui_Nonstop
from nonstop import *
from text_printer import *
import math
import os.path
import re
import sys
import time
import common
import font_parser
### You should have received a copy of the GNU General Public License
### along with the Super Duper Script Editor.
### If not, see <http://www.gnu.org/licenses/>.
################################################################################




class NonstopViewer(QtGui.QDialog):
  def __init__(self, parent = None):
    super(NonstopViewer, self).__init__(parent)
    
    self.ui = Ui_Nonstop()
    self.ui.setupUi(self)
    self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
    
    self.lines = []
    
    self.ui.actionSaveImg = QtGui.QAction("Save image...", None, triggered = self.saveImage)
    self.ui.actionSaveImg.setShortcut("Ctrl+S")
    self.addAction(self.ui.actionSaveImg)
  
  def load(self, filename):
    self.nonstop = NonstopParser()
    self.nonstop.load(filename)
    
    if len(self.nonstop.script_pack) == 0:
      return
    
    self.bg = get_trial(self.nonstop.script_pack[0].scene_info, show_box = False, show_sprite = False)

# Path: ui_nonstop.py
# class Ui_Nonstop(object):
#     def setupUi(self, Nonstop):
#         Nonstop.setObjectName(_fromUtf8("Nonstop"))
#         Nonstop.resize(498, 311)
#         Nonstop.setMinimumSize(QtCore.QSize(498, 311))
#         Nonstop.setMaximumSize(QtCore.QSize(498, 311))
#         Nonstop.setWindowTitle(QtGui.QApplication.translate("Nonstop", "Nonstop Debate Viewer", None, QtGui.QApplication.UnicodeUTF8))
#         icon = QtGui.QIcon()
#         icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/monokuma.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
#         Nonstop.setWindowIcon(icon)
#         self.buttonBox = QtGui.QDialogButtonBox(Nonstop)
#         self.buttonBox.setGeometry(QtCore.QRect(339, 280, 151, 31))
#         self.buttonBox.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
#         self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
#         self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
#         self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
#         self.lblPreview = QtGui.QLabel(Nonstop)
#         self.lblPreview.setGeometry(QtCore.QRect(9, 9, 480, 272))
#         self.lblPreview.setFrameShape(QtGui.QFrame.StyledPanel)
#         self.lblPreview.setFrameShadow(QtGui.QFrame.Sunken)
#         self.lblPreview.setText(_fromUtf8(""))
#         self.lblPreview.setObjectName(_fromUtf8("lblPreview"))
# 
#         self.retranslateUi(Nonstop)
#         QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), Nonstop.accept)
#         QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), Nonstop.reject)
#         QtCore.QMetaObject.connectSlotsByName(Nonstop)
# 
#     def retranslateUi(self, Nonstop):
#         pass


# Path: nonstop_viewer.py
from PyQt4 import QtCore, QtGui, Qt
from PyQt4.QtGui import QImage, QPainter, QColor, QLabel, QMatrix
from PyQt4.QtCore import QRect, QRectF
from ui_nonstop import Ui_Nonstop
from nonstop import *
from text_printer import *
import math
import os.path
import re
import sys
import time
import common
import font_parser

### You should have received a copy of the GNU General Public License
### along with the Super Duper Script Editor.
### If not, see <http://www.gnu.org/licenses/>.
################################################################################




class NonstopViewer(QtGui.QDialog):
  def __init__(self, parent = None):
    super(NonstopViewer, self).__init__(parent)
    
    self.ui = Ui_Nonstop()
    self.ui.setupUi(self)
    self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
    
    self.lines = []
    
    self.ui.actionSaveImg = QtGui.QAction("Save image...", None, triggered = self.saveImage)
    self.ui.actionSaveImg.setShortcut("Ctrl+S")
    self.addAction(self.ui.actionSaveImg)
  
  def load(self, filename):
    self.nonstop = NonstopParser()
    self.nonstop.load(filename)
    
    if len(self.nonstop.script_pack) == 0:
      return
    
    self.bg = get_trial(self.nonstop.script_pack[0].scene_info, show_box = False, show_sprite = False)

    qt_pixmap = QtGui.QPixmap.fromImage(self.bg)