示例#1
0
        def __init__(self):
            QWidget.__init__(self)
            progress_base.__init__(self)
            self.setWindowFlags(Qt.FramelessWindowHint
                                | Qt.WindowStaysOnTopHint)
            self.setFixedSize(400, 90)

            main_vbox = QVBoxLayout()
            hbox = QHBoxLayout()
            hbox.setContentsMargins(0, 0, 0, 0)
            self.progress = gpvdm_progress()
            self.spinner = spinner()
            hbox.addWidget(self.progress, 0)
            hbox.addWidget(self.spinner, 0)
            w = QWidget()
            w.setLayout(hbox)
            main_vbox.addWidget(w, 0)

            self.label = QLabel()
            self.label.setText(_("Running") + "...")
            main_vbox.addWidget(self.label)

            self.label_time = QLabel()
            self.label_time.setText("")
            main_vbox.addWidget(self.label_time)

            self.setLayout(main_vbox)
示例#2
0
    def __init__(self, long_error, error):

        self.error = error
        self.file_path = ""
        QWidget.__init__(self)
        self.setWindowTitle(_("Error"))

        self.main_vbox = QVBoxLayout()
        self.setFixedSize(800, 400)
        h_widget = QWidget()
        h_box = QHBoxLayout()
        h_widget.setLayout(h_box)
        image = QLabel()
        icon = icon_get("warning")
        image.setPixmap(icon.pixmap(icon.actualSize(QSize(48, 48))))
        h_box.addWidget(image)

        h_box.setAlignment(image, Qt.AlignTop)

        self.message = QTextEdit()
        help_text = "<big><b>An error has occurred please report this error by clicking ok:<b></big><br><br>"
        help_text2 = "<br><br><big><b>It would also help if you e-mailed the error message to " + get_email(
        ) + " and described what you were doing with the model to make it crash.  Very often there is not enough information in bug reports alone to fix the problem.<br><br>All error reports are gratefully received.<br><br>Rod 5/9/16<b></big>"
        self.message.setText(help_text + long_error + help_text2)
        h_box.addWidget(self.message)

        self.main_vbox.addWidget(h_widget)

        button_widget = QWidget()
        self.main_vbox.addWidget(button_widget)

        self.label_reporting = QLabel(_("Reporting error...."))
        self.label_reporting.hide()

        self.spin = spinner()
        self.spin.hide()

        okButton = QPushButton("OK")
        cancelButton = QPushButton("Cancel")

        button_layout = QHBoxLayout()
        button_layout.addWidget(self.label_reporting)
        button_layout.addWidget(self.spin)

        button_layout.addStretch(1)
        button_layout.addWidget(okButton)
        button_layout.addWidget(cancelButton)
        button_widget.setLayout(button_layout)

        self.setLayout(self.main_vbox)

        okButton.clicked.connect(self.on_ok_clicked)
        cancelButton.clicked.connect(self.close_clicked)
示例#3
0
	def __init__(self,long_error,error):

		self.error=error
		self.file_path=""
		QWidget.__init__(self)
		self.setWindowTitle(_("Error"))

		self.main_vbox=QVBoxLayout()
		self.setFixedSize(800,400)
		h_widget=QWidget()
		h_box=QHBoxLayout()
		h_widget.setLayout(h_box)
		image=QLabel()
		pixmap = QPixmap(os.path.join(get_image_file_path(),"warning.png"))
		image.setPixmap(pixmap)
		h_box.addWidget(image)

		h_box.setAlignment(image,Qt.AlignTop)
		
		self.message = QTextEdit()
		help_text="<big><b>An error has occurred please report this error by clicking ok:<b></big><br><br>"
		help_text2="<br><br><big><b>It would also help if you e-mailed the error message to [email protected] and described what you were doing with the model to make it crash.  Very often there is not enough information in bug reports alone to fix the problem.<br><br>All error reports are gratefully received.<br><br>Rod 5/9/16<b></big>"
		self.message.setText(help_text+long_error+help_text2)
		h_box.addWidget(self.message)
		
		self.main_vbox.addWidget(h_widget)

		button_widget=QWidget()
		self.main_vbox.addWidget(button_widget)
		
		self.label_reporting=QLabel(_("Reporting error...."))
		self.label_reporting.hide()

		self.spin=spinner()
		self.spin.hide()
		
		okButton = QPushButton("OK")
		cancelButton = QPushButton("Cancel")

		button_layout = QHBoxLayout()
		button_layout.addWidget(self.label_reporting)
		button_layout.addWidget(self.spin)

		button_layout.addStretch(1)
		button_layout.addWidget(okButton)
		button_layout.addWidget(cancelButton)
		button_widget.setLayout(button_layout)

		self.setLayout(self.main_vbox)
	
		okButton.clicked.connect(self.on_ok_clicked) 
		cancelButton.clicked.connect(self.close_clicked)
示例#4
0
    def __init__(self):
        QWidget.__init__(self)
        self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)
        self.setFixedSize(400, 70)

        main_vbox = QVBoxLayout()
        hbox = QHBoxLayout()
        hbox.setContentsMargins(0, 0, 0, 0)
        self.progress = gpvdm_progress()
        self.spinner = spinner()
        hbox.addWidget(self.progress, 0)
        hbox.addWidget(self.spinner, 0)
        w = QWidget()
        w.setLayout(hbox)
        main_vbox.addWidget(w, 0)

        self.label = QLabel()
        self.label.setText("Running...")

        main_vbox.addWidget(self.label)

        self.setLayout(main_vbox)
示例#5
0
    def __init__(self, master):
        """Board()
        creates a new board for Chutes and Ladders"""
        Frame.__init__(self, master, bg="white", padx=15,
                       pady=15)  # set up as a Tk frame
        self.grid()  # place the frame in the root window

        # variables
        self.numPlayers = 0
        self.player_list = list()

        # First, the welcome screen:
        # create labels
        self.welcomeLabel = Label(self,
                                  text='CHUTES AND LADDERS',
                                  font="Verdana 30 bold",
                                  fg="gray30")
        self.welcomeLabel.grid(row=0, columnspan=4)
        self.playerLabel = Label(self,
                                 text='How many players?',
                                 font="Calibri")
        self.playerLabel.grid(row=1, columnspan=4)

        # create options for numPlayers (1-4 players)
        self.player1 = Button(self,
                              text='1',
                              command=lambda: self.set_num_players(1))
        self.player1.grid(row=2, column=0)
        self.player2 = Button(self,
                              text='2',
                              command=lambda: self.set_num_players(2))
        self.player2.grid(row=2, column=1)
        self.player3 = Button(self,
                              text='3',
                              command=lambda: self.set_num_players(3))
        self.player3.grid(row=2, column=2)
        self.player4 = Button(self,
                              text='4',
                              command=lambda: self.set_num_players(4))
        self.player4.grid(row=2, column=3)

        self.next = Button(self,
                           text='Play!',
                           command=lambda: self.create_board(),
                           state=DISABLED)
        self.next.grid(row=3, columnspan=4)

        # Second: the actual game screen. Nothing is gridded yet (will be gridded in create_board)
        # title
        self.title = Label(self,
                           text='CHUTES AND LADDERS',
                           font="Verdana 30 bold",
                           fg="gray30")

        # game announcer/commentator
        self.text = StringVar()
        self.comments = Label(self,
                              anchor=S,
                              wraplength=200,
                              borderwidth=3,
                              relief=GROOVE,
                              height=38,
                              width=30,
                              textvariable=self.text,
                              font="Calibri",
                              fg="White",
                              bg="gray65")
        self.text.set("Welcome to Chutes and Ladders!\nThere are " +
                      str(self.numPlayers) +
                      " players playing in this game.\n")

        # game board
        self.boardGIF = PhotoImage(file="gameBoard.gif")
        self.board = Label(self, image=self.boardGIF)

        # forward and backwards buttons
        self.forward = Button(self,
                              text='Forward',
                              font="Verdana 20 bold",
                              fg="gray65",
                              state=DISABLED)
        self.backward = Button(self,
                               text='Backward',
                               font="Verdana 20 bold",
                               state=DISABLED)

        # spinner
        self.spinner = spinner.spinner(
            200, 300, 20,
            Frame.__init__(self, master, bg="white", padx=5, pady=5))