Beispiel #1
0
def toolbar(colora, colorb):
    """ Ubuntu themed toolbar -> Constantly updated"""
    screen.blit(transform.scale(images["toolbar"], (res_x, 30)), (0, 0))
    # Ubuntu Info/Deco --> Proportionate to screen resolution
    screen.blit(
        fixedFont.render("Ubuntu Desktop - Splash 2.0  |  Help", 1, (colorb)),
        [5, 5])
    screen.blit(images["toolbar-apps"], (res_x - 300, 2))
    # Blit real time onto screen
    screen.blit(
        fixedFont.render(datetime.now().strftime('%I:%M:%S %p'), 1, (colorb)),
        [res_x - 150, 4])
    # Username + Mouse position relative to canvas
    if rects["canvas"].collidepoint(rm()):
        screen.blit(
            fixedFont.render(
                "Welcome %s  |  X:%d  Y:%d  |  FPS: %d" %
                (username(), cm()[0], cm()[1], round(clock.get_fps())), 1,
                (colorb)), [res_x * .38, 3])
    else:
        screen.blit(
            fixedFont.render(
                "Welcome %s  |  %s  |  FPS: %d" %
                (username(), "Not on Canvas", round(clock.get_fps())), 1,
                (colorb)), [res_x * .38, 3])
Beispiel #2
0
 def getFile(self):
   default_path = "/home/" + username()
   if self.sender().text() == "Input File":
     fname = QFileDialog.getOpenFileName(self, "Input File", default_path)[0]
     self.input_ent.clear()
     self.input_ent.insert(fname)
   elif self.sender().text() == "Output File":
     fname = QFileDialog.getSaveFileName(self, "Output File", default_path)[0]
     self.output_ent.clear()
     self.output_ent.insert(fname)
Beispiel #3
0
def git_dcommit():

    print 'Preparing to commit in svn'
    log.info('Preparing to commit in svn')
    print '=========================='
    c = pexpect.spawn('git svn dcommit')
    c.expect(username() + "@svne1.access.nokiasiemensnetworks.com's password:")
    c.sendline(password)
    c.expect(pexpect.EOF, timeout=None)
    c.terminate()
    print 'Commited!\n'
    log.info('Commited!')
    print '==========================='
    print 'Done\n'
Beispiel #4
0
def git_dcommit():

    print 'Preparing to commit in svn'
    log.info('Preparing to commit in svn')
    print '=========================='
    c = pexpect.spawn('git svn dcommit')
    c.expect(username() + "@svne1.access.nokiasiemensnetworks.com's password:")
    c.sendline(password)
    c.expect(pexpect.EOF, timeout=None)
    c.terminate()
    print 'Commited!\n'
    log.info('Commited!')
    print '==========================='
    print 'Done\n'
Beispiel #5
0
def git_rebase(branch):

    #:begin git svn rebase :#
    gitobj = Git()
    global password
    password = getpass('Password for svn:')
    print 'Requested: ', branch
    log.info('Requested:%s ', branch)
    gitobj.checkout(branch)
    print 'Switched to %s.Proceed to rebase' % branch
    log.info('Switched to %s.Proceed to rebase' % branch)
    child = pexpect.spawn('git svn rebase')
    child.expect(username() +
                 "@svne1.access.nokiasiemensnetworks.com's password:")
    child.sendline(password)
    child.expect(pexpect.EOF, timeout=None)
    child.terminate()
    print 'Done\n'
    log.info('Done\n')
Beispiel #6
0
def git_rebase(branch):

    #:begin git svn rebase :#
    gitobj = Git()
    global password
    password = getpass('Password for svn:')
    print 'Requested: ', branch
    log.info('Requested:%s ', branch)
    gitobj.checkout(branch)
    print 'Switched to %s.Proceed to rebase' % branch
    log.info('Switched to %s.Proceed to rebase' % branch)
    child = pexpect.spawn('git svn rebase')
    child.expect(
        username() + "@svne1.access.nokiasiemensnetworks.com's password:")
    child.sendline(password)
    child.expect(pexpect.EOF, timeout=None)
    child.terminate()
    print 'Done\n'
    log.info('Done\n')
Beispiel #7
0
    def send_mail(self, *args):
        """
        Function that will send out a descriptive message
        to me whether the iso succeded,or failed.
        """
        outgoing_message = args[0]
        if self.__class__ == SuccessIso:
            outgoing_message += '\n' + send_description()

        sender = find_sender(username())
        receivers = [sender] + [find_sender(people)
                                for people in optional_people if optional_people]
        msg = MIMEText(outgoing_message)

        msg['Subject'] = 'ISO trigger...'
        msg['From'] = sender
        msg['To'] = ','.join(receivers)
        s = smtplib.SMTP('localhost')
        s.sendmail(sender, [sender, ','.join(receivers)], msg.as_string())
        s.quit()
        sys.exit()
Beispiel #8
0
 def header(self):
     from getpass import getuser as username
     from time import gmtime, strftime
     tt = strftime("%Y-%m-%d %H:%M:%S", gmtime())
     return "%s%s %s %s%s%s" % (ColorfulText.Colors.LIGHT_RED, tt, ColorfulText.Colors.END, ColorfulText.Colors.PURPLE, username(), ColorfulText.Colors.END)
def init():
    global hide
    def scan_dir(path):
        print(list(map(os.path.abspath, os.listdir(pwd))))
    cwd = os.getcwd()
    if hide == 0:
        prompt = input(cwd + " | ssutil> ")
    elif hide == 1:
        prompt = input("ssutil> ")
    elif hide == 2:
        prompt = input(cwd + "> ")
    elif hide == 3:
        prompt = input("> ")
    
    if prompt[:2] == "cd":
        try:
            os.chdir(prompt[3:])
        except FileNotFoundError:
            print("Unable to find the specified file.")
            init()
        except OSError:
            print("No directory was specified.")
            init()

    if prompt[:7] == "pccheck":
        os.system("systeminfo |find \"OS\"")
        os.system("systeminfo |find \"Memory\"")

    if prompt[:2] == "up":
        os.chdir("..")
        
    if prompt[:4] == "echo":
        print(prompt[5:])
        
    if prompt[:2] == "ls":
       for dirname, dirnames, filenames in os.walk('.'):

        for subdirname in dirnames:
            print(os.path.join(dirname, subdirname))
            
        for filename in filenames:
            print(os.path.join(dirname, filename))

        if '.git' in dirnames:
            dirnames.remove('.git')
        init()

    if prompt[:3] == "new":
        os.system("mkdir " + prompt[4:])
        init()

    if prompt[:3] == "del":
        os.system("del " + prompt[4:])

    if prompt[:5] == "crash":
        exitc("The end-user manually crashed the utility.")

    if prompt == "help":
        skip()
        print("Command List:")
        print("su - Opens a Command Prompt (not SSUTIL) window with your current user privileges")
        print("netsu [servername] - Possesses the same function as su, but for use if your computer is on a network.")
        print("psu - Opens a PowerShell window with your current user privileges")
        print("netpsu [servername] - Possesses the same function as psu, but for use if your computer is on a network.")
        print("sudo [command] - Runs any CMD command with your current user privileges")
        print("pccheck - Displays information about your "+name)
        print("clear/cls - Clears the screen")
        print("prompt [nothing|path|ssutil|all] - Affects the visibility of elements of the prompt")
        print("cd [dirname] - Changes your current directory")
        print("path - Gets and prints the current path")
        print("copypath - Copies the current path to the clipboard")
        print("ls - Lists directories")
        print("up - Goes up a directory")
        print("open - Opens the specified file")
        print("echo [message] - Prints a message to the console")
        print("new [dirname] - Creates a new directory")
        print("del [filename] - Deletes the specified file")
        print("web [URL] - Opens the specified URL in your browser")
        print("wsearch [search term] - Searches the web for the specified search term")
        print("exit - Gracefully exits the utility")
        print("crash - Invokes an SSUTIL crash.")
        skip()
        init()

    if prompt[:6] == "prompt":
        if prompt[7:] == "all":
            hide = 0
        if prompt[7:] == "ssutil":
            hide = 1
        if prompt[7:] == "path":
            hide = 2
        if prompt[7:] == "nothing":
            hide = 3
        init()

    if prompt[:4] == "open":
        cmdsafe("start " + prompt[5:])

    if prompt[:3] == "web":
        if prompt[4:] == "":
            print("The command was typed improperly.")
            print("Usage: web [URL]")
        else:
            webbrowser.open(str(prompt[4:]))
        init()

    if prompt[:7] == "wsearch":
        if prompt[8:] == "":
            print("The command was typed improperly.")
            print("Usage: wsearch [search term]")
        else:
            if str(platform.system()) == "Windows":
                webbrowser.open("www.bing.com/search?q=" + prompt[8:])
            else:
                webbrowser.open("www.google.com/search?q=" + prompt[8:])

    if prompt[:3] == "cmd":
        os.system(prompt[4:])
        init()

    if prompt[:5] == "clear":
        if str(platform.system()) == "Windows":
            os.system("cls")
        else:
            os.system("clear")
        init()

    if prompt[:3] == "cls":
        if str(platform.system()) == "Windows":
            os.system("cls")
        else:
            os.system("clear")
        init()

    if prompt[:4] == "path":
        print(os.getcwd())
        init()

    if prompt[:4] == "exit":
        try:
            quit()
        except EOFError:
            print("")

    if prompt[:4] == "sudo":
        if prompt[5:] == "":
            print("The command was typed improperly.")
            print("Usage: sudo [command]")
            init()
        cmdsafe("runas /noprofile /user:"******"\\" +username()+ " " + prompt[5:])
        init()

    if prompt[:2] == "su":
        cmdsafe("runas /noprofile /user:"******"\\" +username()+ " cmd")
        init()

    if prompt[:5] == "netsu":
        cmdsafe("runas /noprofile /user:"******"\\" +username()+ " cmd")
        init()

    if prompt[:3] == "psu":
        cmdsafe("runas /noprofile /user:"******"\\" +username()+ " powershell")
        init()

    if prompt[:6] == "netpsu":
        cmdsafe("runas /noprofile /user:"******"\\" +username()+ " powershell")
        init()

    if prompt[:8] == "copypath":
        cmdsafe("echo " + os.getcwd().strip() + "| clip")

    if prompt == None:
        init()

    else:
        init()