Esempio n. 1
0
def main():
    app = QtWidgets.QApplication(sys.argv)
    window = MainApp()
    window.show()
    sys.exit(app.exec_())
Esempio n. 2
0
    def split_to_char(self, ser, word):
        for x in range(len(word)):
            ch1 = word[x]
            ser.write(ch1.encode())
            print(ch1)

    def on_pauseBtn1_clicked(self):
        print("Pause Btn Clicked")

    def on_resumeBtn1_clicked(self):
        print("Resume Btn Clicked")

    def on_abortBtn1_clicked(self):
        print("Abort Btn Clicked")

    def on_restartBtn1_clicked(self):
        print("Restart Btn Clicked")

    def on_backBtn1_clicked(self):
        print("back Btn Clicked")

    def addLineToFileDisplay(self, line, lineno):
        self.ui.fileDisplay.addItem(line)
        #self.ui.progress.setValue(lineno)


if __name__ == '__main__':
    app = QtWidgets.QApplication([])
    window = MainScreen()
    window.show()
    sys.exit(app.exec_())
class Tests(Testing.PeacockTester):
    qapp = QtWidgets.QApplication([])

    def setUp(self):
        super(Tests, self).setUp()
        self.test_exe = Testing.find_moose_test_exe()
        self.test_input_file = "../../common/transient.i"
        self.input_count = 0
        self.input_file = None
        self.output = ""
        self.total_steps = 0
        self.current_step = 0
        self.progress_count = 0
        self.csv_enabled = False
        self.input_file_in_use = None

    def createWidget(self, args=[], csv_enabled=False):
        w = ExecuteRunnerPlugin()
        exe_info = ExecutableInfo()
        exe_info.setPath(self.test_exe)
        tree = InputTree(exe_info)
        tree.setInputFile(self.test_input_file)
        num_steps = TimeStepEstimate.findTimeSteps(tree)
        w.onNumTimeStepsChanged(num_steps)
        self.assertEqual(w._total_steps, 8)
        w.needCommand.connect(lambda: self.needCommand(w, args, csv_enabled))
        w.needInputFile.connect(self.needInputFile)
        w.outputAdded.connect(self.outputAdded)
        w.runProgress.connect(self.runProgress)
        w.startJob.connect(self.startJob)
        w.setEnabled(True)
        return w

    def needInputFile(self, input_file):
        self.input_count += 1
        self.input_file = input_file
        data = None
        with open(self.test_input_file, "r") as f:
            data = f.read()

        with open(input_file, "w") as f:
            f.write(data)

    def needCommand(self, runner, args, csv):
        runner.setCommand(self.test_exe, args, csv)

    def outputAdded(self, text):
        self.output += text

    def runProgress(self, current, total):
        self.current_step = current
        self.total_steps = total
        self.progress_count += 1

    def startJob(self, current, total, t):
        self.current_step = current
        self.total_steps = total

    def testBasic(self):
        w = self.createWidget()
        self.assertFalse(w.run_button.isEnabled())
        w.runEnabled(True)
        self.assertTrue(w.run_button.isEnabled())
        QTest.mouseClick(w.run_button, Qt.LeftButton)
        self.assertEqual(self.input_count, 1)
        self.assertEqual(w.exe_path, self.test_exe)
        self.assertEqual(w.exe_args, [])
        w.runner.process.waitForFinished(-1)
        self.assertNotEqual(self.output, "")
        self.assertGreater(len(self.output), 20)
        self.assertEqual(self.progress_count, 8)
        self.assertEqual(self.total_steps, 8)
        self.assertEqual(self.current_step, 8)
Esempio n. 4
0
def main():
    app = QtWidgets.QApplication(sys.argv)
    window1 = MainWindow()
    window1.show()
    app.exec_()
Esempio n. 5
0
def main():
    app = QtWidgets.QApplication(sys.argv)
    win = SportsPlan()
    win.show()
    sys.exit(app.exec_())
Esempio n. 6
0
def show_gui():
    """Creates an instance of the UI and displays it"""
    app = QtWidgets.QApplication(sys.argv)
    user_interface = InterfaceWrapper()
    user_interface.show()
    app.exec_()
Esempio n. 7
0
def run():
	if __name__ == '__main__':
	    app = QtWidgets.QApplication(sys.argv)
	    ex = Grid_Ui()
	    ex.showMaximized()
	    sys.exit(app.exec())
Esempio n. 8
0
                exporter = pg.exporters.ImageExporter(
                    self.spectrogramChannels[channel].scene())
                exporter.export(f'{self.PLOT_DIR}/spec-{channel}.png')

        pdf = PDF()
        plots_per_page = pdf.construct(self.PLOT_DIR)

        for elem in plots_per_page:
            pdf.print_page(elem, self.PLOT_DIR)

        now = datetime.datetime.now()
        now = f'{now:%Y-%m-%d %H-%M-%S.%f %p}'
        try:
            os.mkdir(self.PDF_DIR)
        except:
            pass
        pdf.output(f'{self.PDF_DIR}/{now}.pdf', 'F')
        try:
            shutil.rmtree(self.PLOT_DIR)
        except:
            pass

        qtw.QMessageBox.information(self, 'success', 'PDF has been created')


if __name__ == '__main__':
    app = qtw.QApplication(sys.argv)
    mw = MainWindow()
    sys.exit(app.exec_())
def main():
	app = QtWidgets.QApplication(sys.argv)
	MainWindow = QtWidgets.QMainWindow()
	ui = Ui_MainWindow()
	ui.setupUi(MainWindow)
	
	# creating database
	inventory = Database()
	cursor = inventory.database.cursor()

	def show_message(text, type):
		msg = QMessageBox()
		msg.setWindowTitle("Inventory Manager")
		msg.setText("     "+text+"     ")
		msg.setIcon(type)
		x = msg.exec_()

	def insert_data_to_table(tableObj, tablename: str):
		content = inventory.load_data(tablename)
		tableObj.setRowCount(0)
		for row_number,row_data in enumerate(content):
			tableObj.insertRow(row_number)
			for column_number, data in enumerate(row_data):
				tableObj.setItem(row_number, column_number,QtWidgets.QTableWidgetItem(str(data)))

	def updateStock():
		try:
			if ui.stockItemId.text().isnumeric():
				date = datetime.datetime.now().strftime("%x")
				id_ = int(ui.stockItemId.text())
				quantity = int(ui.stockItemQuantity.text())
				inventory.database.execute("INSERT INTO stockhistory VALUES(?, ?, ?)", (id_, quantity, date))
				inQuan = cursor.execute("SELECT products.quantity FROM products WHERE products.id = ?",(id_,))
				inQuantity = inQuan.fetchone()
				inQuantity = inQuantity[0]
				inQuantity += quantity
				cursor.execute("UPDATE products SET quantity = ? WHERE id = ?",(inQuantity, id_))
				ui.stockItemId.setText("")
				ui.stockItemQuantity.setText("")
		except (ValueError, TypeError):
			show_message("Item ID is not registered.")
		run_items()


	def addItem():
		try:
			id_ = int(ui.newItemId.text())
			price = int(ui.newItemPrice.text())
			itemCursor= cursor.execute("SELECT products.id from products").fetchall()
			desc = ui.newItemDesc.text()
			item_list = []
			for item in itemCursor:
				item_list.append(item[0])
			if id_ not in item_list:
				if ui.newItemId.text().isnumeric():	
					try:				
						cursor.execute("INSERT INTO products VALUES(?, ?, ?, ?)", (id_, desc, price, 0))
						ui.newItemId.setText("")
						ui.newItemPrice.setText("")
						ui.newItemDesc.setText("")
						show_message("Item successfully added!",QMessageBox.Information)
						run_items()
					except ValueError:
						show_message("Price cannot be empty.", QMessageBox.Warning)
			else:
				show_message("The Item ID already exists.")
				ui.newItemId.setText("")
				ui.newItemPrice.setText("")
				ui.newItemDesc.setText("")
				run_items()
		except ValueError:
			pass

			
	def updateTrans():
		date = datetime.datetime.now().strftime("%x")
		client = ui.clientName.text()

		try:
			id_ =  int(ui.purchaseId.text())
			quantity = int(ui.purchaseQuantity.text())
		except ValueError:
			show_message("Item ID and quantity must be numeric.", QMessageBox.Warning)
		else:
			itemCursor= cursor.execute("SELECT products.id from products").fetchall()
			item_list = []
			for item in itemCursor:
				item_list.append(item[0])
			if id_ in item_list:
				inventory.database.execute("INSERT INTO transhistory VALUES(?, ?, ?, ?)", (id_, quantity, client, date))
				inQuan = cursor.execute("SELECT products.quantity FROM products WHERE products.id = ?",(id_,))
				inQuantity = inQuan.fetchone()
				inQuantity = inQuantity[0]
				inQuantity -= quantity
				cursor.execute("UPDATE products SET quantity = ? WHERE id = ?",(inQuantity, id_))
				cursor.connection.commit()
				show_message("Transaction successful.", QMessageBox.Information)
			else:
				show_message("Item is not registered", QMessageBox.Warning)

		ui.clientName.setText("")
		ui.purchaseId.setText("")
		ui.purchaseQuantity.setText("")
		return

	def updateDashView():
		noOfItems = cursor.execute("SELECT COUNT(*) FROM products").fetchone()
		ui.numberOfItems.setText(str(noOfItems[0]))
		outOfStock = cursor.execute("SELECT COUNT(*) FROM products WHERE products.quantity < 1").fetchone()
		ui.numberOfOutStock.setText(str(outOfStock[0]))
		numberOfSales = cursor.execute("SELECT COUNT(*) FROM transhistory").fetchone()
		ui.monthlySales.setText(str(numberOfSales[0]))
		QuantityAndPrice = cursor.execute("SELECT transhistory.id, transhistory.quantity FROM transhistory")
		Ids = []
		for row in QuantityAndPrice:
			Ids.append((row[0], row[1]))
		monthlyIncome = 0
		for row in Ids:
			price = cursor.execute("SELECT price FROM products WHERE id = ?",(row[0],)).fetchone()
			monthlyIncome += price[0] * row[1]
		ui.monthlyIncome.setText("Rs "+str(monthlyIncome))

	# run functions relevant to particular page
	def run_dash():
		ui.stackedWidget.setCurrentIndex(3)
		updateDashView()
		

	def run_items():
		ui.stackedWidget.setCurrentIndex(1)
		insert_data_to_table(ui.productTbl, 'products')
		ui.stockItemUpdateBtn.clicked.connect(updateStock)
		ui.newItemSaveBtn.clicked.connect(addItem)
		cursor.connection.commit()

	def run_sales():
		ui.stackedWidget.setCurrentIndex(2)
		ui.savePurchaseBtn.clicked.connect(updateTrans)

	def run_history():

		def productHist():
			ui.stackedHistory.setCurrentIndex(0)
			insert_data_to_table(ui.productHistoryTbl, 'stockhistory')
			
		def transHist():
			ui.stackedHistory.setCurrentIndex(1)
			insert_data_to_table(ui.transHistoryTbl, 'transhistory')

		ui.stackedWidget.setCurrentIndex(0)
		productHist()
		ui.productHistoryBtn.clicked.connect(productHist)
		ui.transHistoryBtn.clicked.connect(transHist)

	# starting with the dashboard
	ui.stackedWidget.setCurrentIndex(3)
	insert_data_to_table(ui.productHistoryTbl, 'stockhistory')
	run_history()
	run_dash() 

	# navbar button configuration
	ui.dashBtn.clicked.connect(run_dash)
	ui.itemsBtn.clicked.connect(run_items)
	ui.salesBtn.clicked.connect(run_sales)
	ui.historyBtn.clicked.connect(run_history)


	MainWindow.show()
	sys.exit(app.exec_())
	inventory.database.close()
def main():
    calibratePressureSensors(5)
    app = QtWidgets.QApplication(sys.argv)
    main = MainWindow()
    main.show()
    sys.exit(app.exec_())
Esempio n. 11
0
class Tests(Testing.PeacockTester):
    qapp = QtWidgets.QApplication([])

    def createData(self,
            name,
            default="",
            cpp_type="string",
            basic_type="String",
            description="",
            group_name="",
            required=True,
            options="",
            ):
        return {"name": name,
                "default": default,
                "cpp_type": cpp_type,
                "basic_type": basic_type,
                "description": description,
                "group_name": group_name,
                "required": required,
                "options": options,
                }

    def checkParameter(self,
            p,
            name,
            default="",
            description="",
            value="",
            user_added=False,
            required=False,
            cpp_type="string",
            group_name="Main",
            comments="",
            ):
        self.assertEqual(p.name, name)
        self.assertEqual(p.default, default)
        self.assertEqual(p.description, description)
        self.assertEqual(p.value, value)
        self.assertEqual(p.user_added, user_added)
        self.assertEqual(p.required, required)
        self.assertEqual(p.cpp_type, cpp_type)
        self.assertEqual(p.group_name, group_name)
        self.assertEqual(p.comments, comments)

    def testBasic(self):
        p = ParameterInfo(None, "p0")
        y = self.createData("p1", default="foo", cpp_type="some type", description="description", group_name="group", required=True)
        p.setFromData(y)
        y["default"] = "foo"
        self.checkParameter(p, "p1", value="foo", default="foo", cpp_type="some type", description="description", group_name="group", required=True)

    def testCopy(self):
        p = ParameterInfo(None, "p0")
        p1 = p.copy(None)
        self.assertEqual(p.__dict__, p1.__dict__)

    def testDump(self):
        p = ParameterInfo(None, "p0")
        o = StringIO()
        p.dump(o)
        val = o.getvalue()
        self.assertIn("Name", val)

    def testTypes(self):
        p = ParameterInfo(None, "p0")
        y = self.createData("p1", cpp_type="vector<string>", basic_type="Array", default=None)
        p.setFromData(y)
        self.assertEqual(p.needsQuotes(), True)
        self.assertEqual(p.isVectorType(), True)
        self.assertEqual(p.default, "")
        p.value = "foo"
        self.assertEqual(p.inputFileValue(), "'foo'")

        y = self.createData("p1", cpp_type="bool", basic_type="Boolean", default="0")
        p.setFromData(y)
        self.assertEqual(p.value, "false")
        self.assertEqual(p.default, "false")
        self.assertEqual(p.needsQuotes(), False)
        self.assertEqual(p.isVectorType(), False)
        self.assertEqual(p.inputFileValue(), "false")

        y = self.createData("p1", cpp_type="bool", basic_type="Boolean", default="1")
        p.setFromData(y)
        self.assertEqual(p.value, "true")
        self.assertEqual(p.default, "true")

        y = self.createData("p1", cpp_type="bool")
        p.setFromData(y)
        self.assertEqual(p.value, "false")
        self.assertEqual(p.default, "false")
Esempio n. 12
0
def startgui():
    import sys
    app = QtWidgets.QApplication(sys.argv)
    form = App()
    form.show()
    app.exec_()
Esempio n. 13
0
def run():
    app = QtWidgets.QApplication(sys.argv)
    dr = DiceRoller()
    sys.exit(app.exec_())
Esempio n. 14
0
def main():
    app = QtWidgets.QApplication(sys.argv)
    ex = MainWindow()
    ex.show()
    sys.exit(app.exec())
Esempio n. 15
0
def main():
    app = QtWidgets.QApplication(sys.argv)  # A new instance of QApplication
    form = ExampleApp()  # We set the form to be our ExampleApp (design)
    form.show()  # Show the form

    sys.exit(app.exec_())
Esempio n. 16
0
def main():
	app = QtWidgets.QApplication(sys.argv)
	window = testgui()
	sys.exit(app.exec_())
Esempio n. 17
0
def main():
    app = QtWidgets.QApplication(sys.argv)
    gui = MainUi()
    gui.show()
    sys.exit(app.exec_())
Esempio n. 18
0
def run():
    app = QtWidgets.QApplication(sys.argv)
    window = MainWindow()
    window.show()
    app.exec_()
Esempio n. 19
0
def main():
    floodit = QtWidgets.QApplication(sys.argv)
    floodit.setWindowIcon(QtGui.QIcon("instance.png"))
    Window = FloodIt()
    Window.show()
    sys.exit(floodit.exec_())
Esempio n. 20
0
import sys
Esempio n. 21
0
def main():
    ##### Test ######
    app = QtWidgets.QApplication(argv)
    Interfaz = Ui()
    Interfaz.show()
    exit(app.exec_())
Esempio n. 22
0
def main():
    app = QtWidgets.QApplication(sys.argv)
    window = Application()
    window.show()
    app.exec()
Esempio n. 23
0
def main():
    app = QtWidgets.QApplication(sys.argv)
    app.setStyleSheet(open("css/main.css", "r").read())
    controller = Controller()
    controller.show_login("")
    sys.exit(app.exec_())
Esempio n. 24
0
from PyQt5 import QtWidgets, uic
import sys, os

curdir = os.path.abspath(os.path.dirname(__file__))

class Ui(QtWidgets.QMainWindow):
    def __init__(self):
        super(Ui, self).__init__() # Call the inherited classes __init__ method
        uic.loadUi(os.path.join(curdir, 'qt_sample_ui.ui'), self) # Load the .ui file
        self.show() # Show the GUI
        
app = QtWidgets.QApplication(sys.argv) # Create an instance of QtWidgets.QApplication
window = Ui() # Create an instance of our class
app.exec_() # Start the application
Esempio n. 25
0
def main():
    app = QtWidgets.QApplication(sys.argv)
    w = Widget()
    w.show()
    sys.exit(app.exec_())
Esempio n. 26
0
# -*- coding: utf-8 -*-
import json
import sys
import requests
from fbs_runtime.application_context.PyQt5 import ApplicationContext
from PyQt5 import QtWidgets
from PyQt5.QtCore import *

from Newsify import Ui_MainWindow  # импорт нашего сгенерированного файла

app = QtWidgets.QApplication([])  # открытие интерфейса


class mywindow(QtWidgets.QMainWindow):
	def __init__(self):
		super(mywindow, self).__init__()
		self.ui = Ui_MainWindow()
		self.ui.setupUi(self)  # Подключение графики
		self.my_web = self.ui.brs  # Подключение браузера
		self.ui.find.clicked.connect(self.find)
		self.ui.else_1.clicked.connect(self.find1)
		self.combo = self.ui.filter  # подключение комбо-бокса
		self.combo.activated[str].connect(self.filters)
		self.acs = ''  # инициализация переменной токена
		self.ui.list.itemDoubleClicked.connect(self.listing)
		self.kat = ''  # инициализация переменной категории
		self.next = ''
		self.old = ''
		self.ui.countri.activated[str].connect(self.Countri)
		self.ui.region.activated[str].connect(self.Region)
		self.ui.citi.activated[str].connect(self.Citi)
Esempio n. 27
0
            else:
                self.RecVideo.setEnabled(True)
                self.SaveImages.setEnabled(True)
                self.CalibBlack.setEnabled(True)
                self.CalibBG.setEnabled(True)
                running = True
                capture_thread = threading.Thread(target=grab, args = (q1,q2))
                capture_thread.start()
                self.DispImage.setText('Stop Displaying Image')
                b_set = 0
                bg_set = 0
        else:
            running = False
            self.RecVideo.setChecked(False) #stop recording video
            self.RecVideo.setEnabled(False)
            self.SaveImages.setEnabled(False)
            self.ApplyImg.setEnabled(False)
            self.ApplyImg.setChecked(False)
            self.DispImage.setText('Display Image')

    def closeEvent(self, event):
        global running
        running = False


if __name__ == "__main__":
    #capture_thread = threading.Thread(target=grab, args = (q1,q2))
    app = QtWidgets.QApplication(sys.argv)  # A new instance of QApplication
    form = MyWindowClass()  # We set the form to be our app
    form.show()  # Show the form
    app.exec_()  # and execute the app
 def run_app():
     app = QtWidgets.QApplication(sys.argv)
     pg.setConfigOptions(imageAxisOrder='row-major')
     mainwin = FilterSliderWidgetUI()
     mainwin.show()
     app.exec_()
    from plugins.MeshPlugin import MeshPlugin
    from plugins.BackgroundPlugin import BackgroundPlugin
    from plugins.ClipPlugin import ClipPlugin
    from plugins.ContourPlugin import ContourPlugin
    from plugins.OutputPlugin import OutputPlugin
    from plugins.CameraPlugin import CameraPlugin
    from plugins.MediaControlPlugin import MediaControlPlugin
    from plugins.BlockPlugin import BlockPlugin

    widget = ExodusPluginManager(plugins=[
        lambda: VTKWindowPlugin(size=size), BlockPlugin, MediaControlPlugin,
        VariablePlugin, FilePlugin, GoldDiffPlugin, MeshPlugin,
        BackgroundPlugin, ClipPlugin, ContourPlugin, CameraPlugin, OutputPlugin
    ])

    widget.show()

    return widget


if __name__ == '__main__':
    import sys
    app = QtWidgets.QApplication(sys.argv)
    from peacock.utils import Testing
    filenames = Testing.get_chigger_input_list('mesh_only.e',
                                               'mug_blocks_out.e',
                                               'vector_out.e', 'displace.e')
    widget = main()
    widget.FilePlugin.onSetFilenames(filenames)
    sys.exit(app.exec_())
Esempio n. 30
0
    def __init__(self):
        app = QtWidgets.QApplication(sys.argv)
        main_window = QtWidgets.QMainWindow()
        self.ui = ui.Ui_ant()
        self.ui.setupUi(main_window)

        convert_bond_raw_path = r"C:\quanttime\src\convertbond\raw_data.csv"
        self.ui.lineEdit.setText(convert_bond_raw_path)
        convert_bond_raw_after_process_path = r"C:\quanttime\src\convertbond\raw_data_after_process.csv"
        self.ui.lineEdit_2.setText(convert_bond_raw_after_process_path)

        # 可转债到转股期的信息更新文件目录及文件名,放在初始化中,主要是好修改配置
        self.converion_period_file = r"C:\quanttime\src\convertbond\conversion_period.csv"

        # 生信息转换pushbutton的signal连接
        self.ui.pushButton.clicked.connect(
            self.process_convertbond_raw_basic_info)

        # 显示可转债基本信息表pushbotton的signal连接
        self.ui.pushButton_2.clicked.connect(self.display_convert_basic_info)

        # 可转债实时折溢价情况刷新pushbutton的signal连接
        self.ui.pushButton_4.clicked.connect(self.display_premium)

        # 更新是否到转股期到csv表格
        self.ui.pushButton_3.clicked.connect(self.update_bond2stock_period)

        # 重点监测可转债checkboxsignal
        self.ui.checkBox.stateChanged.connect(
            self.select_or_cancel_all_bond_status)
        # premium table的checkbox signal
        self.ui.checkBox_8.stateChanged.connect(
            self.select_or_cancel_premium_table_state)

        # 转债的基本信息,从本地csv中读取的信息
        self.df_convertbond_basic_info = pd.DataFrame()

        # 可转债的实时行情df
        self.df_bond_rt_quotes = pd.DataFrame()
        self.quotes_bond_code = []

        # 正股的实时行情df
        self.df_stock_rt_quotes = pd.DataFrame()
        self.quotes_stock_code = []

        # 转债基本信息以及转债实时行情,股票实时行情
        self.df_bond_total = pd.DataFrame()

        # 点击premium表的单元格,发射信号,生成转债与正股的2档价量信息
        self.ui.tableWidget_2.cellClicked.connect(self.display_buy_sell_info)

        # 点击可转债折溢价交易按钮触发交易信号
        self.ui.pushButton_5.clicked.connect(self.trade_convert_bond_premium)

        # tushare connect context
        token = "17e7755e254f02cc312b8b7e22ded9a308924147f8546fdfbe653ba1"
        ts.set_token(token)
        self.cons = ts.get_apis()
        # ts 授权
        self.pro = ts.pro_api()

        # 设定默认的行情数据, 通达信默认行情源,tushare,joinquant可选
        self.ui.checkBox_4.setCheckState(QtCore.Qt.Checked)
        self.ui.checkBox_5.setCheckState(QtCore.Qt.Unchecked)
        self.ui.checkBox_7.setCheckState(QtCore.Qt.Unchecked)

        # 注册交易接口,初始化时,登录交易接口默认为不登录,需要勾选才登录
        self.user = 0
        self.ui.checkBox_6.setCheckState(QtCore.Qt.Unchecked)
        self.ui.checkBox_6.stateChanged.connect(self.register_trade)

        # 显示基本信息表
        self.display_convert_basic_info()

        main_window.show()
        sys.exit(app.exec_())