Beispiel #1
0
def title(title):
    # Window title
    if osname == 'nt':
        # Windows systems
        ossystem('title ' + title)
    else:
        # Most standard terminals
        print('\33]0;' + title + '\a', end='')
        sys.stdout.flush()
Beispiel #2
0
def title(title):
    # Window title
    if osname == "nt":
        # Windows systems
        ossystem("title " + title)
    else:
        # Most standard terminals
        print("\33]0;" + title + "\a", end="")
        sys.stdout.flush()
Beispiel #3
0
def title(title: str):
    if osname == 'nt':
        """
        Changing the title in Windows' cmd
        is easy - just use the built-in
        title command
        """
        ossystem('title ' + title)
    else:
        """
        Most *nix terminals use
        this escape sequence to change
        the console window title
        """
        print('\33]0;' + title + '\a', end='')
        sys.stdout.flush()
Beispiel #4
0
    def on_AddCP(self):
        quit_msg = "Cannot add new cutplan when simulation running."
        if self.CPRunning:
            QtWidgets.QMessageBox.warning(self.MainWindow,
                                          'Simulation running...', quit_msg,
                                          QtWidgets.QMessageBox.Ok)
            return

        # Ping to see if can connect, use wait cursor
        QtWidgets.QApplication.setOverrideCursor(
            QtGui.QCursor(QtCore.Qt.WaitCursor))
        ping = ossystem("ping -n 1 " + self.host)
        QtWidgets.QApplication.restoreOverrideCursor()
        quit_msg = "Check internet connection to Log Scanner Server."
        if ping:
            QtWidgets.QMessageBox.critical(self.MainWindow,
                                           "Connection Failed", quit_msg,
                                           QtWidgets.QMessageBox.Ok)
            return

        self.AddDialog = QtWidgets.QDialog()
        self.AddCPUI = AddCPUI()
        self.AddCPUI.setupUi(self.AddDialog, host=self.host)
        self.AddDialog.show()
        self.AddCPUI.buttonBox.accepted.connect(self.AddFunction)
Beispiel #5
0
    def ping(self):
        response = ossystem("ping -c 1 " + self.host)

        if response == 0:
            pingstatus = "Network Active"
        else:
            pingstatus = "Network Error"

        return pingstatus
Beispiel #6
0
def title(title: str):
    if osname == 'nt':
        """
        Changing the title in Windows' cmd
        is easy - just use the built-in
        title command
        """
        ossystem('title ' + title)
    else:
        """
        Most *nix terminals use
        this escape sequence to change
        the console window title
        """
        try:
            print('\33]0;' + title + '\a', end='')
            sys.stdout.flush()
        except Exception:
            # wasn't able to set title (e.g., running headless)
            pretty_print(Exception)
Beispiel #7
0
    def AddFunction(self):
        tempID = self.id
        newCPID = self.AddCPUI.chosen

        # Ping to see if can connect, use wait cursor
        QtWidgets.QApplication.setOverrideCursor(
            QtGui.QCursor(QtCore.Qt.WaitCursor))
        ping = ossystem("ping -n 1 " + self.host)
        QtWidgets.QApplication.restoreOverrideCursor()
        quit_msg = "Check internet connection to Log Scanner Server."
        if ping:
            QtWidgets.QMessageBox.critical(self.MainWindow,
                                           "Connection Failed", quit_msg,
                                           QtWidgets.QMessageBox.Ok)
            return

        conn = sql.connect('Driver={SQL Server};'
                           'Server=192.168.3.55;'
                           'Database=SequalLogScanner;'
                           'UID=sa;'
                           'PWD=gg8976@;')

        f = open("support\\cpquery2.sql", 'r')
        sqltext = f.read()
        sqltext = sqltext.replace("@CPID", str(newCPID))
        data = pd.read_sql(sqltext, conn)
        newCP = data.iloc[0]
        conn.close()
        f.close()

        self.CPSched.AddNewRow(newCP)
        self.ready.append(False)
        self.TVSetUp()
        tempSched = self.CPSched
        self.widget.CPSched = tempSched
        showPerc = self.widget.LogPlotter.showPerc
        showFront = self.widget.LogPlotter.showFront
        self.widget.LogPlotter = LogPlotGUI(self.widget.CPSched, self.LDDir)
        self.widget.LogPlotter.showPerc = showPerc
        self.widget.LogPlotter.showFront = showFront
        self.widget.LogPlotter.showLog = self.checkBox.isChecked()
        self.widget.LogPlotter.showBoards = self.checkBox_3.isChecked()
        self.widget.LogPlotter.showFL = self.checkBox_2.isChecked()
        self.widget.LogPlotter.show3m = self.checkBox_4.isChecked()
        self.widget.LogPlotter.showOpenFace = self.checkBox_OF.isChecked()
        self.tableView.selectRow(tempID)
        self.on_idChange()
        self.progressCP = sum(self.ready)
        a = self.progressCP
        b = self.CPSched.Cutplans.shape[0]
        self.loadingText.setText(str(a) + "/" + str(b) + " Cutplans Loaded")
def open_site(site, debug=False):
    """ Opens a site using the default system browser """

    openercmd = get_browser_command()
    if openercmd:
        fullcmd = ' '.join([openercmd, '"{}"'.format(site)])
        if debug:
            print('Found browser opener: {}'.format(openercmd))
            print('Running: {}'.format(fullcmd))
        retcode = ossystem(fullcmd)
        if retcode:
            # opener errored
            print('Error opening site: {}'.format(fullcmd))
        return retcode
    else:
        print('No valid command found to open that site: {}'.format(site))
        return 1
Beispiel #9
0
def open_site(site, debug=False):
    """ Opens a site using the default system browser """

    openercmd = get_browser_command()
    if openercmd:
        fullcmd = ' '.join([openercmd, '"{}"'.format(site)])
        if debug:
            print('Found browser opener: {}'.format(openercmd))
            print('Running: {}'.format(fullcmd))
        retcode = ossystem(fullcmd)
        if retcode:
            # opener errored
            print('Error opening site: {}'.format(fullcmd))
        return retcode
    else:
        print('No valid command found to open that site: {}'.format(site))
        return 1
Beispiel #10
0
    def on_LoadLogs(self):
        quit_msg = "Cannot update logs when simulation running."
        if self.CPRunning:
            QtWidgets.QMessageBox.warning(self.MainWindow,
                                          'Simulation running...', quit_msg,
                                          QtWidgets.QMessageBox.Ok)
            return

        # Ping to see if can connect, use wait cursor
        QtWidgets.QApplication.setOverrideCursor(
            QtGui.QCursor(QtCore.Qt.WaitCursor))
        ping = ossystem("ping -n 1 " + self.host)
        QtWidgets.QApplication.restoreOverrideCursor()
        quit_msg = "Check internet connection to Log Scanner Server."
        if ping:
            QtWidgets.QMessageBox.critical(self.MainWindow,
                                           "Connection Failed", quit_msg,
                                           QtWidgets.QMessageBox.Ok)
            return

        self.ReloadFunction()
        quit_msg = "Log data successfully updated from server."
        QtWidgets.QMessageBox.warning(self.MainWindow, 'Log Data Updated!',
                                      quit_msg, QtWidgets.QMessageBox.Ok)
Beispiel #11
0
            debug_output("Rich presence updated")
        except Exception as e:
            # Discord not launched
            debug_output("Error launching Discord RPC thread: " + str(e))
        sleep(15)  # 15 seconds to respect Discord rate limit


if __name__ == "__main__":
    from multiprocessing import freeze_support
    freeze_support()
    cpu = cpuinfo.get_cpu_info()
    title(getString("duco_python_miner") + str(MINER_VER) + ")")

    if osname == "nt":
        # Unicode fix for windows
        ossystem("chcp 65001")
        # Colorama
        init(autoreset=True, convert=True)
    else:
        init(autoreset=True)

    try:
        from multiprocessing import (Manager, Process, Value, cpu_count,
                                     current_process)
        manager = Manager()
        # Multiprocessing globals
        khashcount = Value("i", 0)
        accepted = Value("i", 0)
        rejected = Value("i", 0)
        hashrates_list = manager.dict()
        totalhashrate_mean = manager.list()
Beispiel #12
0
 def removeFile(self):
     """ delete the files """
     ossystem("rm " + self.tvshow_ + "/" + self.getBaseName() + ".*")
Beispiel #13
0
 def runcmd(self, cmd, check=True):
     print(cmd)
     ret = ossystem(cmd)
     if check and ret != 0:
         raise RuntimeError('execute failed cmd: %s' % cmd)
     return ret
Beispiel #14
0
from input import *

maindata = genericdatasource()

sources = [satxml, lamedb]

datasources = [maindata]

for source in sources:
    datasources.append(source())

for source in datasources:
    source.setDatasources(datasources)

while True:
    ossystem("/usr/bin/clear")
    list = []
    for index in list(range(len(datasources))):
        list.append(datasources[index].getName() +
                    (" (%d sats)" %
                     len(datasources[index].transponderlist.keys())))
    index = inputChoices(list, "q", "quit")
    if index is None:
        break

    while True:
        print(datasources[index].getStatus())
        list = []
        for action in datasources[index].getCapabilities():
            list.append(action[0])
        action = inputChoices(list)
Beispiel #15
0
 def run(self):
     """ play in the background """
     ossystem(self.cmd)