Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to add gui to my program ?
Forum Updated to NodeBB v4.3 + New Features

How to add gui to my program ?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gopys
    wrote on last edited by
    #1

    Hello everyone,

    I am unable to solve the following issue. How can I add simple gui to my program ? I made even picture with the design, but I don't know where to add my code in the qt4 designer, so once I click the "ok" button the program to be executed in the terminal with my python script:
    @import hashlib
    import sys
    import binascii
    import re

    #SSIDEND = "1234AB" #example
    if len(sys.argv) < 2:
    print str(len(sys.argv))
    print "Usage: "
    print " python2.6 touchspeedcalc_test.py [SSID]"
    print "Where [SSID] are the last 6 characters of the SSID."
    sys.exit()

    SSIDEND = sys.argv[1].upper()
    #sys.argv[1].decode("hex")

    if len(SSIDEND) == 6:
    #SpeedTouch:
    FINDPOS = 0
    elif len(SSIDEND) == 4:
    #BT HomeHub:
    FINDPOS = 1
    else:
    print "SSID-end must be either 6 or 4 characters."
    sys.exit()

    YEARS = [2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012]
    #YEARS = [ 2009, 2008, 2007, 2006, 2005, 2004, 2010 ]
    #YEAR = sys.argv[2].lower()

    def ascii2hex(char):
    return hex(ord(char))[2:].upper()

    CHARSET = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    BINCODE = binascii.unhexlify("".join(SSIDEND.split()))
    #print "Compressed SSID: ", BINCODE

    for YEAR in YEARS:
    FILE = "db/db_with_keys___" + str(YEAR) + ".dat"
    INFILE = open(FILE,"rb")
    FILEDATA = INFILE.read()
    INFILE.close()
    WHEREFOUND = FILEDATA.find(BINCODE, 0)
    while (WHEREFOUND > -1):
    if WHEREFOUND % 3 == FINDPOS:
    PRODIDNUM = (WHEREFOUND / 3) % (363636)
    PRODWEEK = (WHEREFOUND / 3) / (363636) +1
    PRODID1 = PRODIDNUM / (36*36)
    PRODID2 = (PRODIDNUM / 36) % 36
    PRODID3 = PRODIDNUM % 36
    SERIAL = 'CPdd%s%s%s' % (YEAR-2000,PRODWEEK,ascii2hex(CHARSET[PRODID1:PRODID1+1]),ascii2hex(CHARSET[PRODID2:PRODID2+1]),ascii2hex(CHARSET[PRODID3:PRODID3+1]))
    SHA1SUM = hashlib.sha1(SERIAL).digest().encode("hex").upper()
    SSID = SHA1SUM[-6:]
    ACCESSKEY = SHA1SUM[0:10]
    if len(SSIDEND) == 4:
    # BT HomeHub password is lowercase:
    ACCESSKEY = ACCESSKEY.lower()
    #print "Serial number:", str(SERIAL) # does not give proper serial number for the thompsons BT series
    #print "SHA1SUM:", str(SHA1SUM)
    print "", str(ACCESSKEY)

    WHEREFOUND = FILEDATA.find(BINCODE, WHEREFOUND+1)@
    

    I made and image with the basic concept: http://imgbox.com/abq24DNa

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      Hi,

      Qt Designer is only a GUI Designer; you must create a GUI Application in order to do what you need.

      However, once you created you Application, you can use QProcess to launch external process.

      TIP. You can also use PyQt/PySide and write you application directly in Python

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Gopys
        wrote on last edited by
        #3

        QProcess is what I needed, thank you mcosta.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved