예제 #1
0
def make_Home():
    str_title = 'Welcome to the FESTO automated grading tool!'
    str_welcome = 'This tool is an aid in helping to grade 4TC00 assignments. \n' \
                  'Below you can select what functionalities you want to use. \n' \
                  'If this is the first time running the program, go to the ' \
                  'directory setup. \n' \
                  'Otherwise you can go and run the simulations ' \
                  'or if this is already done go to the grading.'
    column1 = ([sg.Text('Directory setup:')], [sg.Button('-DIR SETUP-')])
    column2 = ([sg.Text('Simulation runner:')], [sg.Button('-SIM RUNNER-')])

    column3 = ([sg.Text('Grading assignments:')], [sg.Button('-GRADER-')])

    layout = [[sg.Text(str_title, font=("Helvetica", 25))],
              [sg.Image('Resources/festo.png', size=(1100, 250))],
              [sg.HSeparator()],
              [
                  sg.Text(str_welcome, font=("Helvetica", 12)),
              ], [sg.HSeparator()],
              [
                  sg.Text('Directory setup:', size=(20, 1)),
                  sg.VSeparator(),
                  sg.Text('Simulation runner:', size=(20, 1)),
                  sg.VSeparator(),
                  sg.Text('Grading assignments:', size=(20, 1))
              ],
              [
                  sg.Button('-DIR SETUP-', size=(20, 1), pad=(3, 0)),
                  sg.VSeparator(),
                  sg.Button('-SIM RUNNER-', size=(20, 1), pad=(3, 0)),
                  sg.VSeparator(),
                  sg.Button('-GRADER-', size=(20, 1), pad=(3, 0))
              ], [sg.HSeparator()], [sg.Button('-EXIT-')]]
    return sg.Window('Home', layout, finalize=True)
예제 #2
0
파일: GUI.py 프로젝트: macko0606/Jmac
 def pop(title, text):
     page = [[sg.Text(text)], [sg.HSeparator()],
             [
                 sg.Button("YES",
                           size=(10, 1),
                           border_width=10,
                           enable_events=True,
                           key="-YES-"),
                 sg.Button("NO",
                           size=(10, 1),
                           border_width=10,
                           enable_events=True,
                           key="-NO-")
             ]]
     window = sg.Window(title, page)
     while True:
         event, values = window.read()
         if event == "-YES-":
             window.close()
             return True
         elif event == "-NO-":
             window.close()
             return False
         else:
             return False
     window.close()
예제 #3
0
def make_win3(culture_columns, culture_list, location):

    try:

        culture_column_one = []
        culture_column_two = []

        print('Entering Culture loop')

        for s_num, s in enumerate(culture_list[0]):

            culture_column_one += [sg.Text(culture_columns[s_num] + ':')],
            culture_column_two += [sg.Text(s)],

        print('Setting new layout')
        culture_layout = [[
            sg.Column(culture_column_one),
            sg.Column(culture_column_two)
        ], [sg.HSeparator()], [sg.Button('Exit')]]
    except:
        sg.Popup('Failed culture layout')

    return sg.Window('Perceived Cultural Details',
                     culture_layout,
                     size=(550, 500),
                     finalize=True)
예제 #4
0
def make_SimRunner():
    layout = [
        [sg.Text('Simulation runner', font=("Helvetica", 15))],
        [sg.HSeparator()],
        [
            sg.Text(
                "Click the button below to start executing the tests on the uploaded assignments. \n"
                "Take care of the following points: \n"
                "  -   You are NOT able to use your PC, while the program is running tests \n"
                "  -   You should make sure there is no other program running. \n"
                "  -   You should make sure no other window is opened. \n"
                "  -   You should run this program on one single 1080p monitor."
            )
        ], [sg.Button('-SIM EXECUTER-')], [sg.HSeparator()],
        [sg.Button('-GRADER-'), sg.Button('-HOME-')]
    ]
    return sg.Window('Simulation runner', layout, finalize=True)
예제 #5
0
def make_DirSetup():
    layout = [
        [
            sg.Text('Directory setup', font=("Helvetica", 15)),
            sg.Button('refresh')
        ], [sg.HSeparator()],
        [
            sg.Text(
                'On this page, the general directory, '
                'the TwinCat directory and Unity directory have to be set.')
        ],
        [
            sg.Text('Select a general directory:', size=(35, 1)),
            sg.Input(size=(55, 1), key='input dir'),
            sg.FolderBrowse(key="-IN1-"),
            sg.Button("Submit directory", size=(14, 1))
        ],
        [
            sg.Text('Select the directory for TwinCat (devenv.exe):',
                    size=(35, 1)),
            sg.Input(size=(55, 1), key='input TwinCat'),
            sg.FileBrowse(key="-IN2-"),
            sg.Button("Submit TwinCat", size=(14, 1))
        ],
        [
            sg.Text('Select the directory for Unity:', size=(35, 1)),
            sg.Input(size=(55, 1), key='input unity'),
            sg.FileBrowse(key="-IN3-"),
            sg.Button("Submit Unity", size=(14, 1))
        ], [sg.HSeparator()],
        [
            sg.Text(
                'When the above three directories are specified, '
                'the directory initializers can be run by clicking th buttons below:'
            )
        ], [sg.Button("-DIR INITIALIZER-"),
            sg.Button("-DIR INITIALIZER2-")], [sg.HSeparator()],
        [
            sg.Text(
                "Please open the File Explorer and navigate to the specified general directory, \n"
                "you will see the new all_assignments folder in which you have to un-zip the \n"
                "to be graded files. When this is done, go to the next step")
        ], [sg.HSeparator()], [sg.Button('-SIM RUNNER-'),
                               sg.Button('-HOME-')]
    ]
    return sg.Window('Directory setup', layout, finalize=True)
예제 #6
0
def load_window():
    # First the window layout in 2 columns
    input_column = [[
        sg.Text("Ransomware File     "),
        sg.In(size=(65, 1), enable_events=True, key="-FILE-"),
        sg.FileBrowse(),
    ],
                    [
                        sg.Text("Ransomware Name     "),
                        sg.In(size=(65, 1), enable_events=True, key="-NAME-"),
                    ],
                    [
                        sg.Text("Ransomware Extension"),
                        sg.In(size=(65, 1),
                              enable_events=True,
                              key="-EXTENSION-"),
                    ], [sg.Button('Submit')], [sg.HSeparator()],
                    [sg.Text("Input instructions")]]

    results_viewer_column = [
        [sg.Text("Diagnostics Results")],
        [sg.Text(size=(100, 100), key="-TOUT-")],
        [sg.Image(key="-IMAGE-")],
    ]

    # ----- Full layout -----
    layout = [[
        sg.Column(input_column),
        sg.VSeperator(),
        sg.Column(results_viewer_column),
    ]]

    window = sg.Window("Ransomware Solution Recomendation System", layout)

    while True:
        event, values = window.read()
        if event == "Exit" or event == sg.WIN_CLOSED:
            break

        if event == "Submit":
            file = values["-FILE-"]
            name = values["-NAME-"]
            extension = values["-EXTENSION-"]

            # function call to main func
            '''
            print(file)
            print(name)
            print(extension)
            '''

            #out =  main(file,name,extension) //return (json1 json2 json3)

            window["-TOUT-"].update(
                json.dumps(parsed, indent=4, sort_keys=True))
예제 #7
0
def make_Grader():
    layout = [
        [
            sg.Text('Grading Assignments', font=("Helvetica", 15)),
            sg.Button("refresh_grades")
        ], [sg.HSeparator()],
        [
            sg.Text(
                'On this page the recorded tests performed on the assignments can be graded'
            )
        ],
        [sg.Text('Click here to start grading:'),
         sg.Button('Start Grading')], [sg.HSeparator()],
        [
            sg.Text("Final scores per assignments",
                    font=("Helvetica", 13),
                    size=(35, 1)),
            sg.VSeparator(),
            sg.Text("Sub-scores for selected assignment",
                    font=("Helvetica", 13),
                    size=(35, 1))
        ], [sg.HSeparator()],
        [sg.Combo(groups, key='drop-down'),
         sg.Button("select group")],
        [
            sg.Text("", key="grades", size=(50, 25), enable_events=True),
            sg.VSeparator(),
            sg.Text("", key='selected group', size=(50, 25))
        ],
        [
            sg.Text("", size=(50, 1)),
            sg.VSeparator(),
            sg.Text("", size=(35, 1), key="nan evaluator"),
            sg.Button("correct"),
            sg.Button("incorrect")
        ], [sg.HSeparator()],
        [sg.Text("Export grades to directory"),
         sg.Button("Export Grades")], [sg.HSeparator()],
        [sg.Button('-HOME-'), sg.Button('-EXIT-')]
    ]
    return sg.Window('Grading Assignments', layout, finalize=True)
예제 #8
0
def init_window() -> sg.Window:
    sg.theme('SystemDefault1')

    WINDOW_LAYOUT = [
        [sg.Text("Image Folder"),
         sg.In(enable_events=True, key="-FOLDER-"),
         sg.FolderBrowse(),
         ],
        [sg.Listbox(values=[], enable_events=True, key="-FILE LIST-", disabled=True,
                    select_mode=sg.LISTBOX_SELECT_MODE_EXTENDED, size=(70, 20))
         ],
        [sg.Text("File"),
         sg.Text(size=(70, 1), key="-TFILEPATH-")],
        [sg.HSeparator()],  # =====================================
        [sg.Text("Exif date", size=(20, 1)),
         sg.Text(key="-TEXIF_DATE-", size=(20, 1))],
        [sg.Text("Exif date original", size=(20, 1)),
         sg.Text(key="-TEXIF_DATE_ORIGINAL-", size=(20, 1))],
        [sg.Text("Exif date digitalized", size=(20, 1)),
         sg.Text(key="-TEXIF_DATE_DIGITALIZED-", size=(20, 1))],
        [sg.HSeparator()],  # =====================================
        [sg.Text("New original date", size=(20, 1)),
         sg.In(key="-TNEW_DATE-", disabled=True),
         sg.CalendarButton("Edit", key="-BEDIT_DATE-", disabled=True)
        ],
        [sg.Button("Update", key="-BUPDATE-", disabled=True),
         sg.Button("Update & select next", key="-BUPDATE_SEL_NEXT-", disabled=True),
         sg.Button("Update selected files", key="-BUPDATE_ALL_SELECTED-", disabled=True),
         sg.Button("Update all files in directory", key="-BUPDATE_ALL_DIR-", disabled=True),],
        [sg.ProgressBar(10, key="-PROGRESS-", visible=False, size=(50, 20))],
        [sg.Text(key="-STATUS-", size=(70, 1))],
        [sg.Text("Datetime guess format strings")],
        [sg.Multiline(default_text=DATE_DEFAULT_PATTERN, key="-DATE_PATTERN-")],
    ]

    return sg.Window("Exif date editor", WINDOW_LAYOUT)
예제 #9
0
    def __init__(self):
        self.front_picture = 'graphic/front_picture.png'
        sg.theme('DarkBlue')

        # ------------------------------------  LAYOUT COLUMNS  ------------------------------------
        # COLUMN 1
        self.file_list_column = [
            [
                sg.Text("Import Video"),
                sg.In(size=(30, 1), enable_events=True, key="-FOLDER-"),
                sg.FolderBrowse(),
            ],
            [
                sg.Button("Videos", enable_events=True, key="-VIDEO FOLDER-"),
                sg.Button("Analyzes", enable_events=True, key="-ANALYZES-"),
            ],
            [
                sg.Listbox(values=[],
                           enable_events=True,
                           size=(25, 30),
                           key='-FILE LIST-',
                           auto_size_text=False,
                           font=("Helvetica", 20)),
            ],
        ]

        # COLUMN 2
        self.image_viewer_column = [
            [
                sg.Text(text="Video options",
                        size=(20, 1),
                        font=("Helvetica", 15)),
            ],
            [
                sg.Button("Delete video",
                          enable_events=True,
                          key="-DELETE VIDEO-",
                          disabled=True,
                          button_color=["white", "red"]),
                sg.Button("View video",
                          enable_events=True,
                          key="-VIEW VIDEO-",
                          disabled=True),
                sg.Button("Analyze",
                          enable_events=True,
                          key="-CAM SHIFT-",
                          disabled=True),
                sg.Text(
                    text="Trace color:",
                    size=(9, 1),
                    key="-TRACE COLOR-",
                    visible=True,
                ),
                sg.CBox('Blue', key='-COLOR BLUE-', enable_events=True),
                sg.CBox('X-Velocity Color',
                        key='-COLOR XV-',
                        enable_events=True,
                        default=True),
                sg.CBox('Y-Velocity Color',
                        key='-COLOR YV-',
                        enable_events=True),
            ],
            [
                sg.HSeparator(),
            ],
            [
                sg.In(size=(5, 1),
                      enable_events=True,
                      key="-H MIN-",
                      default_text='0'),
                sg.In(size=(5, 1),
                      enable_events=True,
                      key="-H MAX-",
                      default_text='255'),
                sg.In(size=(5, 1),
                      enable_events=True,
                      key="-S MIN-",
                      default_text='0'),
                sg.In(size=(5, 1),
                      enable_events=True,
                      key="-S MAX-",
                      default_text='255'),
                sg.In(size=(5, 1),
                      enable_events=True,
                      key="-V MIN-",
                      default_text='254'),
                sg.In(size=(5, 1),
                      enable_events=True,
                      key="-V MAX-",
                      default_text='255'),
                sg.CBox('Video', key='-HSV VIDEO-', default=True),
                sg.Button("HSV",
                          enable_events=True,
                          key="-HSV-",
                          disabled=True),
            ],
            [
                sg.HSeparator(),
            ],
            [
                sg.Text(text="Max speed",
                        size=(9, 1),
                        key="-MS-",
                        visible=True),
                sg.Text(text="none",
                        size=(9, 1),
                        key="-MAX SPEED-",
                        visible=True),
            ],
            [
                sg.HSeparator(),
            ],
            [
                sg.Text(text="file_name",
                        size=(40, 1),
                        key="-TOUT-",
                        visible=True,
                        font=("Helvetica", 25)),
            ],
            [
                sg.Image(key="-IMAGE FRAME-", filename=self.front_picture),
            ],
        ]

        # ------------------------------------  FULL LAYOUT  ------------------------------------
        self.layout = [[
            sg.Text(text="Disc Golf Video Analyzer",
                    size=(30, 1),
                    key="-DGVA-",
                    visible=True,
                    font=("Helvetica", 40),
                    justification="center",
                    pad=((400, 400), (1, 1)))
        ], [
            sg.HSeparator(),
        ],
                       [
                           sg.Column(self.file_list_column),
                           sg.VSeperator(),
                           sg.Column(self.image_viewer_column),
                       ]]

        self.window = sg.Window("Disc Golf Tracker", self.layout)
                 [sg.InputText(size=(4, 1), key=('-DENSITY-'))],
                 [sg.InputText(size=(10, 1), key=('-NAME-'))],
                 [sg.InputText(size=(4, 1), key=('-SEED-'))]]

right_layout = [
    [sg.Text("NOTES")],
    [sg.Text("(4, 5, or 6) 1d6 >= # results in a system present")],
    [sg.Text("Db and txt files will be created in /sector_db")],
    [
        sg.Text(
            "Using the same seed with the same density will produce the same sector"
        )
    ]
]

layout = [[sg.Text("""Generate Window""")], [sg.HSeparator()],
          [
              sg.Column(left_layout),
              sg.VSeparator(),
              sg.Column(middle_layout),
              sg.VSeparator(),
              sg.Column(right_layout)
          ], [sg.Button('Generate'),
              sg.Button('Cancel')]]

# Create the Window
window = sg.Window("""Bartleby's Sector Builder v0.8.2""", layout)
# Event Loop to process "events" and get the "values" of the inputs

event, values = window.read()
# if event == sg.WIN_CLOSED or event == 'Cancel': # if user closes window or clicks cancel
예제 #11
0
 [
     sg.Text("", size=(27, 5)),
     sg.Button(
         "Pension",
         size=(30, 3),
         key="pen",
     )
 ],
 [
     sg.Text("", size=(27, 5)),
     sg.Button("Gratuity", size=(30, 3), key="gra")
 ],
 [
     sg.Text("", size=(27, 5)),
     sg.Button("Leave Salary", size=(30, 3), key="leave")
 ], [sg.HSeparator()],
 [
     sg.Image(r'python.gif',
              enable_events=True,
              key='python',
              tooltip="Click here to know more!"),
     sg.Text("", size=(60, 1)),
     sg.Image(r'gnu-linux.png',
              enable_events=True,
              key='gnu',
              tooltip="Click here to know more!")
 ], [
     sg.Text("How to use :", font=(0.5), size=(65, 1)),
 ],
 [
     sg.Text(
예제 #12
0
class Toolbar(NavigationToolbar2Tk):
    def __init__(self, *args, **kwargs):
        super(Toolbar, self).__init__(*args, **kwargs)


################################
# Setting up the UI
################################
menu_column = [[sg.T("Graph smoothing (seconds):")],
               [
                   sg.Slider(range=(1, 30),
                             default_value=5,
                             size=(20, 10),
                             key="__SMOOTHING__",
                             orientation="horizontal")
               ], [sg.HSeparator()], [sg.T("Time offsets (seconds):")],
               [sg.HSeparator()], [sg.Text("Data available to graph:")]]

################################
# Create time offset sliders for each file
################################
for name in device_names:
    device_offset = "__" + name.replace(" ", "").lower() + "__OFFSET__"
    menu_column.insert(-2, [
        sg.T(name, size=(20, 1)),
        sg.In(default_text="0", key=device_offset, size=(5, 1))
    ])

################################
# Setup Plot column UI
################################
예제 #13
0
def windows_ini(width, high):
    matplotlib.use("TkAgg")
    frame2_layout = [
        [
            sg.Text(
                "                                                          ")
        ],
        [sg.Text("Choose a file: "),
         sg.FileBrowse("File", key="-FILE-")],
        [sg.Button("UPDATE"), sg.Button("STOP")],
        [sg.Button("RESET")],
        [
            sg.ProgressBar(orientation="horizontal",
                           max_value=10,
                           size=(10, 20),
                           key="fwUpdateProgress"),
            sg.Text("0%  ", key="progress")
        ],
        [sg.Text("Level MinMax:"),
         sg.Text("                 ", key="minMax")],
    ]
    information_column = [
        [
            sg.Checkbox("Boot Only", key="boot-checkbox"),
            sg.Combo("", size=(10, 1), key="port-list")
        ],
        [sg.Button("CONNECT"), sg.Button("RE-CONNECT")],
        [sg.Text("Fw Version:"),
         sg.Text("____________", key="-version-")],
        [
            sg.Text("Build:"),
            sg.Text("__________________________________", key="-build-")
        ],
        [
            sg.HSeparator(color="White"),
        ],
        [
            sg.Text(
                "                                                          ")
        ],
        [sg.Text("Temp:"), sg.Text("####", key="-temp-")],
        [sg.Text("Status"),
         sg.Text("####", size=(6, 1), key="-tempStatus-")],
        [sg.Text("")],
        [sg.Text("CAP1:"),
         sg.Text("####", key="-cap1-"),
         sg.Text("pF")],
        [sg.Text("CAP2:"),
         sg.Text("####", key="-cap2-"),
         sg.Text("pF")],
        [sg.Text("")],
        [sg.Text("Photo:"),
         sg.Text("ON", size=(6, 1), key="-photo-")],
        [sg.Button("READ", key="getSlaveData")],
        [sg.Text("")],
        [sg.Frame(layout=frame2_layout, title="FW")],
    ]

    information_column2_1 = [
        [sg.Text("___", key="Bar1Value")],
        [
            sg.ProgressBar(orientation="vertical",
                           max_value=100,
                           size=(20, 25),
                           key="levelBar1"),
            sg.Canvas(key="-CANVAS-")
        ],
        [sg.Text("___", key="Bar2Value")],
        [
            sg.ProgressBar(orientation="vertical",
                           max_value=100,
                           size=(20, 25),
                           key="levelBar2"),
            sg.Canvas(key="-CANVAS2-")
        ],
    ]

    tab_layout = [[sg.Column(information_column2_1)]]
    tab_layout_config = [
        [
            sg.Text("Sensor lenght: "),
            sg.Input(size=(5, 1), key="-sensor-lenght-"),
            sg.Text("mm")
        ],
        [
            sg.Text("Trigger Level:  "),
            sg.Input(size=(5, 1), key="-Level-"),
            sg.Text("%")
        ],
        [
            sg.Text("Send Interval:  "),
            sg.Input(size=(5, 1), key="-Send-Interval-"),
            sg.Text("s")
        ],
        [
            sg.Text("MODE AT START:  "),
            sg.Combo(["MASTER", "SLAVE"], size=(10, 1), key="Mode")
        ],
        [sg.Text("RS485 Boud: "),
         sg.Input(size=(5, 1), key="-boudRate-")],
        [sg.Text("Status:"),
         sg.Text("                 ", key="configStatus")],
        [sg.ProgressBar(max_value=10, size=(20, 5), key="configProgress")],
        [sg.Text("  ")],
        [
            sg.Button("READ", key="-read-button-"),
            sg.Button("WRITE", key="-write-button-")
        ],
    ]

    tab_control = [[sg.Tab("Info", layout=tab_layout)],
                   [sg.Tab("Config", layout=tab_layout_config)]]

    infeomation_col = [[
        sg.Frame(layout=information_column,
                 title="frame1",
                 vertical_alignment="top",
                 key="frame1")
    ]]

    layout = [
        [
            sg.Column(infeomation_col,
                      vertical_alignment="top",
                      background_color="red"),
            sg.Column([[sg.TabGroup(tab_control)]],
                      size=(width, high - 100),
                      vertical_alignment="top",
                      background_color="red")
        ],
    ]

    #x=np.array ([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
    #y= np.array ([0,10,20,30,40,50,60,70,80,90,100])
    print("Starting")

    # Create the window
    window = sg.Window(
        "EFLS-D2 Test " + version,
        layout,
        size=(width, high),
        finalize=True,
        element_justification="left",
        font="Helvetica 12",
    )
    return window
예제 #14
0
def gui():
    menu = [
        [
            sg.Text('Start', size=(4, 1), background_color='grey'),
            sg.Text('Stop', size=(5, 1), background_color='grey'),
            sg.Text('Level', size=(4, 1), background_color='grey'),
            sg.Text('Mod', size=(31, 1), background_color='grey')
        ],
        [sg.HSeparator()],
        [
            sg.InputText(default_text=30, key='-START-', size=(5, 1)),
            sg.InputText(default_text=180, key='-STOP-', size=(5, 1)),
            sg.InputText(default_text=1, key='-LEVEL-', size=(5, 1)),
            sg.Radio('+',
                     key='-MOD1-',
                     group_id='mod',
                     size=(1, 1),
                     default=True,
                     background_color='#616161'),
            sg.Radio('-',
                     key='-MOD2-',
                     group_id='mod',
                     size=(1, 1),
                     background_color='#616161'),
            sg.Radio('+-',
                     key='-MOD3-',
                     group_id='mod',
                     size=(2, 1),
                     background_color='#616161'),
            sg.Radio('-+',
                     key='-MOD4-',
                     group_id='mod',
                     size=(2, 1),
                     background_color='#616161'),
            sg.Radio('rand',
                     key='-MOD5-',
                     group_id='mod',
                     size=(4, 1),
                     background_color='#616161'),
        ],
        [
            sg.Frame(layout=[[
                sg.Button("1", button_color=('white', 'green'), size=(6, 1)),
                sg.Button("2", button_color=('white', 'green'), size=(6, 1)),
                sg.Button("3", button_color=('white', 'green'), size=(6, 1)),
                sg.Button("4", button_color=('white', 'green'), size=(6, 1)),
                sg.Button("5", button_color=('white', 'green'), size=(6, 1)),
                sg.Button("6", button_color=('white', 'green'), size=(6, 1)),
            ]],
                     title='Simulations',
                     relief=sg.RELIEF_SUNKEN,
                     tooltip='Use these to set flags',
                     background_color='grey')
        ],
    ]

    memory_layout = [
        [
            sg.Text('EPROM', background_color='grey', size=(6, 5)),
            sg.Text('Original: ', key='-ORIGIN-', size=(13, 5)),
            sg.Text('Adaptation (10 cycles): ',
                    key='-ADAPT_EPROM-',
                    size=(13, 5)),
            sg.Text('Saved: ', key="-SAVED-", size=(13, 5)),
        ],
        [
            sg.Text('RAM', background_color='grey', size=(6, 5)),
            sg.Text('Cycle nr.: ', key="-RAM-", size=(13, 5)),
            sg.Text('Ongoing: ', size=(13, 5)),
            sg.Text('Adapted: ', size=(13, 5)),
        ],
    ]

    layout = [
        [
            sg.Frame(layout=[[sg.Column(menu, background_color='grey')]],
                     title='Options',
                     background_color='grey'),
            # sg.Column(menu, background_color='grey'),
            # sg.VSeparator(),
        ],
        [
            sg.Column(memory_layout, background_color='grey'),
        ],
        [
            sg.HSeparator(),
        ],
        [
            sg.Button("QUIT", button_color=('white', 'red')),
            sg.Text('', size=(10, 1), background_color='grey'),  # SPACER
            sg.Button("PLAY",
                      button_color=('white', '#74B72E'),
                      disabled=True,
                      key='-PLAY-'),
            sg.Button("PAUSE",
                      button_color=('white', 'orange'),
                      disabled=True,
                      key='-PAUSE-'),
            sg.Button("RESET",
                      button_color=('white', 'blue'),
                      disabled=True,
                      key='-RESET-')
        ]
    ]
    # when you want to open this window on second screen use - location=(2100, 330)
    window = sg.Window("Memory",
                       layout,
                       margins=(2, 2),
                       background_color='grey')

    return window
예제 #15
0
 def setLayout(self):
     self.layout = [[sg.Column(self.title)], [sg.HSeparator()],
                    [sg.Column(self.primaryWindow)]]
예제 #16
0
                [
                    gui.Text("Dimmer 밝기", size=(12, 1)),
                    gui.Slider((1, 100),
                               key='_SLIDER',
                               default_value=0,
                               orientation='h',
                               size=(17, 20),
                               enable_events=True,
                               disable_number_display=True,
                               disabled=True),
                    gui.Text("0%", key="_BRIGHTNESS", size=(5, 1), pad=(6, 0))
                ]]

    # section2 : 연결 후 보여질 부분
    section2 = [
        [gui.HSeparator()],
        [
            gui.Frame("Presets", [[
                gui.Button("0%", key='_0', disabled=True),
                gui.Button("20%", key='_20', disabled=True),
                gui.Button("40%", key='_40', disabled=True),
                gui.Button("60%", key='_60', disabled=True),
                gui.Button("80%", key='_80', disabled=True),
                gui.Button("100%", key='_100', disabled=True),
                gui.Text("│", pad=(0, 0)),
                gui.InputText("", key='_MANUAL', size=(3, 1), disabled=True),
                gui.Text("%", pad=(0, 0)),
                gui.Button("Apply", key='_APPLY', disabled=True)
            ]])
        ],
        [
예제 #17
0
def launch_gui():

##########################################
# initializing vocabulary list and class
##########################################

    WS = VOC_class.VOC()
    keys = WS.keys

##############################################
# Conjugation function and languages
##############################################

    lang_src = 'german'
    lang_dest = 'french'

############################
# initializing GUI window
############################

    sg.theme('DarkAmber')   # Add a touch of color

# ----- Full layout -----
    new_word_layout = []
    for k in keys:
        new_word_layout.append([sg.Text(k+' :', size=(10, 1)), sg.InputText(key=k)])

    layout = [
            [sg.Menu([['&Source language', ['&french', '&german']],['&list', [WS.list_of_lists()]],
                      ['&About', '&Read me']], tearoff=False)],
            [sg.Text("TEST YOUR SKILLS", size=(35, 1), justification='center', relief=sg.RELIEF_RIDGE)],
            [sg.Button("Generate word", key="-generate-"), sg.In(enable_events=True,
                                                                 key="-word_to_translate-", size=(35, 1))],
            [sg.Text("Enter translation: "), sg.InputText(size=(35, 1), key="-translation-"), sg.Button('Check',
                                                                                                    key="-check-")],
            [sg.Text('', key='-answer-', size=(50, 1))],
            [sg.Text('')],
            [sg.Text("GET INFORMATION", size=(35, 1), justification='center', relief=sg.RELIEF_RIDGE)],
            [sg.Button("ASK GOOGLE (internet connexion needed)", enable_events=True, key='-google-'), sg.In(key='-google_to_translate-', size=(35, 1))],
            [sg.Text('', key='-google_answer-', size=(35, 1))],
            [sg.Button("CONJUGATE", enable_events=True, key='-conjugate-'),
                      sg.In(key='-to_conjugate-', size=(35, 1))],
            [sg.Text('')],
            [sg.HSeparator()],
            [sg.Text('')],
            [sg.Text("ADD A NEW WORD TO YOUR PERSONAL LIST", size=(70, 1), justification='center', relief=sg.RELIEF_RIDGE)],
            [sg.Frame(title="New word to add", layout=new_word_layout), sg.Button('ADD', key="-add_word-")],
            [sg.Text('')],
            [sg.HSeparator()],
            [sg.Text('')],
            [sg.Text("DISPLAY YOUR PERSONAL LIST", size=(70, 1), justification='center', relief=sg.RELIEF_RIDGE)],
            [sg.Button('SHOW LIST', enable_events=True, key='-show_list-')],
            [sg.Text('')],
            [sg.HSeparator()],
            [sg.Text('')],
            [sg.Cancel("Exit")],
            ]
# Create the window
    window = sg.Window("French-German vocabulary", layout)

    word = None

#################
# Event loop
#################

    while True:

        # read action on the window
        event, values = window.read()

        # remove printed message
        window['-answer-'].update('')

        # Change source and destination language
        # ----------------------------------------

        if event == 'french':
            lang_src = 'french'
            conjugate = conjugate_fr
            lang_dest = 'german'
        if event == "german":
            lang_src = 'german'
            conjugate = conjugate_de
            lang_dest = 'french'

        # Show Readme file
        # ----------------------------------

        if event == 'Read me':
            text = open("../README.md", 'r').read()
            new_window = sg.Window('About',
                                   [
                                       [sg.Text(text, text_color='white')]
                                   ])
            while True:
                ev, val = new_window.read()
                if ev == sg.WIN_CLOSED:
                    break
            new_window.close()

        # Change my_list file
        # ------------------------------

        for l in WS.list_of_lists():
            l = l.replace('&','')
            if event == l:
                WS.change_list(l)

        #  Translate from list
        # ----------------------------

        if event == "-generate-":
            # print random word present in WS.list
            word = WS.print_rand()
            window["-word_to_translate-"].update(word[keys[0]])

        if event == "-check-":
            if len(window["-word_to_translate-"].get()) == 0:
                sg.popup("You have to generate a word to translate before looking for the translation !!", title='Error')
            else:
                # check if translation is correct
                if values["-translation-"] in word[keys[1]]:
                    # print message bellow
                    window['-answer-'].update('Correct !')
                # check if synonym
                elif values["-translation-"] in word[keys[7]]:
                    # print messsage bellow
                    window['-answer-'].update('Correct but a better translation would be {}'.format(word[keys[1]]))
                else:
                    # print correct answer
                    text_out = word[keys[1]]+word[keys[7]]
                    window['-answer-'].update('Incorrect, the translation is/are: '+text_out)

        # Google translate
        # -----------------------

        if event == "-google-":
            if len(window["-google_to_translate-"].get()) == 0:
                sg.popup('You have to enter a word to translate !', title='Error')
            else:
                # translation is a class that contains several information in addition to the translation
                translation = Translator().translate(str(window['-google_to_translate-'].get())
                                       , src=lang_src, dest=lang_dest)
                # if text too long, print in external window
                if len(translation.text) < 20:
                    window['-google_answer-'].update('Translation: '+translation.text)
                else:
                    new_window = sg.Window('Translated text',
                                           [
                                               [sg.Text(translation.text)],
                                               [sg.Button('OK', key='-exit-')]
                                           ])
                    while True:
                        ev, val = new_window.read()
                        if ev == sg.WIN_CLOSED:
                            break
                        if ev == '-exit-':
                            break

        #
        # Conjugate
        # ------------------------

        if event == '-conjugate-':
            verb = window['-to_conjugate-'].get()
            if len(verb) == 0:
                sg.popup('You have to enter a verb to conjugate !', title='Error')
            else:
                # conjugate and return table of conjugation
                table_display = conjugate(verb)
                # open window with conjugation information
                sg.Window('Conjugation table of {}'.format(verb), layout=[[sg.Column(table_display)]]).read()



        # Add word to my_list
        # -----------------------

        if event == "-add_word-":

            # if no word is given
            if len(window[keys[0]].get()) == 0:
                sg.popup('At least a new word must be given in order to add a new item to your list !', title='Error')

            else:
                new_word = []
                for k in keys:
                    if len(window[k].get()) != 0:
                        new_word.append(window[k].get())
                    else:
                        new_word.append(" ")

                # Create new window for confirmation
                new_window = sg.Window('Add word',
                                   [
                                    [sg.Text('Add the following new word to your list ?')],
                                    [sg.Text(str(new_word))],
                                    [sg.Button('YES', key='-yes-'), sg.Button('NO', key='-no-')]
                                   ])
                # read event in new window
                while True:
                    ev, val = new_window.read()
                    if ev == sg.WIN_CLOSED:
                        break
                    if ev == '-yes-':
                        WS.add_word(new_word)
                        break
                    if ev == '-no-':
                        break
                new_window.close()

        # -- Show list --
        if event == "-show_list-":
            table = tabulate(WS.my_list, headers=keys, tablefmt='rst')
            sg.Window('My list of vocabulary in alphabetical order',
                      [[sg.Text(table, font='Courier', text_color='white')]]).read()

        # close window
        if event == sg.WIN_CLOSED or event == "Exit":
            break

    window.close()
예제 #18
0
def main():
    layout = [
                [
                    sg.Text(text=datetime.now().strftime(dateFmt[0]), auto_size_text=True, key='-Date-'), 

                    sg.Button('Date Options', key='-DateOptions-'),
                ],
                [
                    sg.Button('+ New Alarm', size=(33, 1), key='-NewAlarm-'), 
                ],
                [
                    sg.HSeparator(),

                ],
                [
                    sg.Listbox(values=[str(i) for i in clocks], enable_events=True, size=(35, 5), key='-AlarmList-'),
                ],
                [
                    sg.Button('Edit Alarm', key='-EditAlarm-'),
                    sg.Button('Delete Alarm', key='-DeleteAlarm-'),
                    sg.Exit(),
                ]
            ]

    window = sg.Window('Alarm Clock', layout)
    opened = True                            

    while True:
        event, values = window.read(timeout=1000)               #Reads events every second

        if opened == True:                                      #When window is opened load instances of 
            with open(f'data/clock.pickle', 'rb') as inF:       #`Clock` class from data/clock.pickle
                while True:
                    try:
                        clocks.append(pickle.load(inF))         #Append the data to `clocks` list in settings.py
                    except EOFError:                            #while there are still items in clock.pickle
                        break

            window['-AlarmList-'].update([str(i) for i in clocks])  #Populate `-AlarmList-` w/ str representations
                                                                    #of each instance of the Clock class from the `clocks` list
            opened = False                                          #Set opened to False so clocks.pickle is only accessed once 
                                                                        
        elif event in ['Exit', sg.WIN_CLOSED]:                      
            with open(f'data/clock.pickle', 'wb') as outF:          #When main window is closed, overwrite clock.pickle
                                                                    #w/ the items in the `clocks` list
                for clock in clocks:
                    pickle.dump(clock, outF, -1)
            opened = False
            break

        elif event == '-DateOptions-':                          #If the 'Date Options' button is clicked
            dateOptions.dateOptions()                           #the dateOptions window is opened.

        elif event == '-NewAlarm-':                                 #If the 'New Alarm' button is clicked
            newAlarm.newAlarm()                                     #the newAlarm window is opened.
            window['-AlarmList-'].update([str(i) for i in clocks])  #then `-AlarmList-` is updated with the new alarm

        elif event == '-EditAlarm-' and len(values['-AlarmList-']): #If an alarm is selected when the 'Edit Alarm' 
                                                                    #button is clicked
            for clock in clocks:                                    #iterate over the `clocks` list until  
                if str(clock) == values['-AlarmList-'][0]:          #correct clock is found. 
                    editAlarm.editAlarm(clock)                      #Open 'Edit Alarm' window with selected clock instance
                    window['-AlarmList-'].update([str(i) for i in clocks])  #update '-AlarmList-' after 'Edit Alarm' is closed
                                                                    
        elif event == '-DeleteAlarm-' and len(values['-AlarmList-']):   #If an alarm is selected and the 'Delete Alarm'
            sg.popup("Alarm Deleted")                                   #button is clicked, delete the alarm
            for clock in clocks:
                if str(clock) == values['-AlarmList-'][0]:               
                    clocks.remove(clock)                                #Then remove the alarm from the `clocks` list
                    window['-AlarmList-'].update([str(i) for i in clocks]) #and update '-AlarmList-'

        for clock in clocks:
            if (str(clock) == datetime.now().strftime('%I:%M %p') and   #Basically, if the current time matches any clock
            clock.on and datetime.today().weekday() in clock.days):     #and that clock is on and the alarm is set to play
                                                                        #on the current day of the week
                alarmPlaying.alarmPlaying(clock)                        #open the 'Alarm Playing' window.
            else:
                continue                                                

        window['-Date-'].update(datetime.now().strftime(dateFmt[0]))    #updates the time text box with the date format specified
                                                                        #in `dateFmt` list in settings.py
    window.close()  
예제 #19
0
from modules.util import ClearWB
from modules.proxy import GetProxy, AddProxy

options = Options()
options.headless = True
browser = webdriver.Chrome(executable_path="./webdriver/chromedriver",
                           options=options)

Sg.theme("TealMono")

layout = [
    [
        Sg.Text("Путь к файлу с адресами:", size=(75, 1)),
        Sg.FileBrowse("Обзор"),
    ],
    [Sg.HSeparator()],
    [Sg.Output(size=(75, 10), echo_stdout_stderr=False)],
    [
        Sg.Text("Добавить прокси (ip:port):"),
        Sg.InputText(do_not_clear=False),
        Sg.Button("Добавить прокси"),
    ],
    [
        Sg.Button("Запуск"),
        Sg.Checkbox("Использовать прокси"),
        Sg.VSeparator(),
        Sg.Button("Очистить файл результатов"),
        Sg.VSeparator(),
        Sg.Button("Выход"),
    ],
]
예제 #20
0
 def title_maker(title):
     return ([sg.Text(f"{title}",
                      justification='right')], [sg.HSeparator()])
예제 #21
0
 def sidebar_maker():
     return [[sg.Text("Menu")], [sg.HSeparator()],
             [sg.Button('Translator', key='-TRANSLATOR-')],
             [sg.Button('Exit', key='-EXIT-')]]
예제 #22
0
                                  size=(27, 15),
                                  orientation='horizontal',
                                  font=('Helvetica', 12),
                                  key="-THRESHOLD-",
                                  pad=(0, (10, 0)))
                    ],
                    [sg.Text(text="Threshold Value", pad=((100, 0), (0, 30)))],
                    [
                        sg.Button(button_text="RUN!",
                                  key="-RUN-",
                                  bind_return_key=True,
                                  pad=((50, 0), 0)),
                        sg.Button(button_text="Open Directory",
                                  key="directory",
                                  pad=((50, 0), 0))
                    ], [sg.HSeparator(pad=(0, (5, 5)))],
                    [sg.Output(size=(40, 40), key="CONSOLE")]]

image_viewer_column = \
    [
    [sg.Image(key="-IMAGE-", size=(800, 800))]
]

layout = [[
    sg.Column(file_list_column),
    sg.VSeperator(),
    sg.Column(image_viewer_column)
]]

gui_queue = queue.Queue(
)  # queue used to communicate between the gui and the threads
예제 #23
0
    def initialWindow(self,
                      convert,
                      input_file="",
                      output_file=cte.OUTPUT_DEFAULT,
                      input_type="",
                      output_type="",
                      use_config=False,
                      config_path=cte.CONFIG_PATH):

        input_type_aux = input_type if input_type != "" else getExtension(
            input_file)
        output_type_aux = output_type if output_type != "" else getExtension(
            output_file)

        input_layout = [[
            sg.Text("Input path",
                    size=(12, 1),
                    text_color="white",
                    background_color=grey_green),
            sg.In(size=(35, 1),
                  key="INPUT FILE",
                  enable_events=True,
                  default_text=input_file),
            sg.FileBrowse()
        ],
                        [
                            sg.Text("Detected input type",
                                    size=(12, 1),
                                    text_color="white",
                                    background_color=grey_green),
                            sg.Combo(cte.ADMITTED_TYPES,
                                     key="INPUT TYPE",
                                     default_value=input_type_aux,
                                     size=(10, 1))
                        ]]
        output_layout = [[
            sg.Text("Output path",
                    size=(12, 1),
                    text_color="white",
                    background_color=grey_green),
            sg.In(size=(35, 1),
                  key="OUTPUT FILE",
                  enable_events=True,
                  default_text=output_file),
            sg.FileBrowse()
        ],
                         [
                             sg.Text("Output type",
                                     size=(12, 1),
                                     text_color="white",
                                     background_color=grey_green),
                             sg.Combo(cte.ADMITTED_TYPES,
                                      key="OUTPUT TYPE",
                                      default_value=output_type_aux,
                                      size=(10, 1),
                                      enable_events=True)
                         ]]

        config_layout = [[
            sg.Text("Config file path",
                    size=(12, 1),
                    text_color="white",
                    background_color=grey_green),
            sg.In(size=(35, 1),
                  key="CONFIG PATH",
                  enable_events=True,
                  default_text=config_path),
            sg.FileBrowse(),
        ],
                         [
                             sg.Radio('Use config file',
                                      'CONFIG RADIO',
                                      key="USE CONFIG",
                                      default=use_config,
                                      background_color=grey_green),
                             sg.Radio('Do not use config file',
                                      'CONFIG RADIO',
                                      key="NOT USE CONFIG",
                                      default=not use_config,
                                      background_color=grey_green)
                         ]]

        buttons_layout = [[sg.Button("RESET"), sg.Button("CONVERT")]]

        layout = [[
            input_layout, [[sg.HSeparator()]], output_layout,
            [[sg.HSeparator()]], config_layout, [[sg.HSeparator()]],
            buttons_layout
        ]]

        self.window = sg.Window("Event Converter",
                                layout,
                                size=(1000, 500),
                                margins=(30, 35),
                                resizable=True,
                                font=(font_family, font_size),
                                background_color=grey_green,
                                button_color=dark_green)

        while True:
            event, values = self.window.read()
            if event == "Exit" or event == sg.WIN_CLOSED:
                break

            elif event == "RESET":
                self.window.Element('INPUT FILE').Update(value="")
                self.window.Element('INPUT TYPE').Update(value="")
                self.window.Element('OUTPUT FILE').Update(value="")
                self.window.Element('OUTPUT TYPE').Update(value="")
                self.window.Element('CONFIG PATH').Update(value="")
                self.window.Element('NOT USE CONFIG').Update(value=True)

            elif event == "INPUT FILE":
                ext = getExtension(values["INPUT FILE"])
                if ext in cte.ADMITTED_TYPES:
                    self.window.Element('INPUT TYPE').Update(value=ext)

            elif event == "OUTPUT FILE":
                ext = getExtension(values["OUTPUT FILE"])
                if ext in cte.ADMITTED_TYPES:
                    self.window.Element('OUTPUT TYPE').Update(value=ext)

            elif event == "OUTPUT TYPE":
                ext = values["OUTPUT TYPE"]
                file = values["OUTPUT FILE"]
                tam = len(getExtension(file))
                if tam > 0:
                    file = file[:-tam]
                if file[-1] == ".":
                    file += ext
                else:
                    file += "." + ext
                self.window.Element('OUTPUT FILE').Update(value=file)

            elif event == "CONVERT":
                i_f = values["INPUT FILE"]
                i_t = values["INPUT TYPE"]
                o_f = values["OUTPUT FILE"]
                o_t = values["OUTPUT TYPE"]
                u_c = values["USE CONFIG"]
                c_p = values["CONFIG PATH"]

                if not os.path.isfile(i_f):
                    sg.popup_error("The input file does not exists")
                elif u_c and not os.path.isfile(c_p):
                    sg.popup_error("The config file does not exists")
                elif i_t not in cte.ADMITTED_TYPES:
                    sg.popup_error("The input type is not supported")
                elif o_t not in cte.ADMITTED_TYPES:
                    sg.popup_error("The output type is not supported")
                else:
                    if u_c:
                        Config(c_p)
                    convert(i_f, o_f, i_t, o_t)
                    sg.popup('CONVERSION FINISHED!!!')

        self.window.close()
예제 #24
0
파일: temp.py 프로젝트: macko0606/Jmac
def loginPage():  #This is the function responsible for the login page
    creds = []  #temp array of credentials
    with open("credentials.txt", "r") as file:
        file.seek(0)  #go to start of txt file
        for line in file:
            creds.append(line)  #add credentials to array
            print(line)
        file.close()
    print(creds)
    errorMessage = ''
    client = creds[0]
    secret = creds[1]
    agent = creds[2]
    username = creds[3]
    password = creds[4]
    redditAccount = ''
    page = [[sg.Text("Sign-In to Reddit Developer Account")],
            [sg.HSeparator()],
            [
                sg.Text("client id:", size=(20, 1)),
                sg.Input(client,
                         size=(25, 1),
                         enable_events=True,
                         key="-CLIENT-")
            ],
            [
                sg.Text("client secret:", size=(20, 1)),
                sg.Input(secret,
                         size=(25, 1),
                         enable_events=True,
                         key="-SECRET-")
            ],
            [
                sg.Text("user agent:", size=(20, 1)),
                sg.Input(agent,
                         size=(25, 1),
                         enable_events=True,
                         key="-AGENT-")
            ],
            [
                sg.Text("username:"******"-USERNAME-")
            ],
            [
                sg.Text("password:"******"-PASS-")
            ],
            [
                sg.Text(errorMessage,
                        size=(30, 1),
                        text_color='red',
                        key="-ERROR-",
                        background_color='white')
            ],
            [
                sg.Button("SAVE",
                          size=(10, 1),
                          border_width=buttonBW,
                          enable_events=True,
                          key="-SAVE-"),
                sg.Button("HELP",
                          size=(10, 1),
                          border_width=buttonBW,
                          enable_events=True,
                          key="-HELP-"),
                sg.Button("CLEAR",
                          size=(10, 1),
                          border_width=buttonBW,
                          enable_events=True,
                          key="-CLEAR-")
            ]]
    window = sg.Window("Sign-In", page)
    while True:
        event, values = window.read()
        if event == "Exit" or event == sg.WIN_CLOSED:
            break
        elif event == "-SAVE-":
            if values["-CLIENT-"] != '' or values["-SECRET-"] != '' or values[
                    "-AGENT-"] != '' or values["-USERNAME-"] != '' or values[
                        "-PASS-"] != '':
                errorMessage = "Signing in..."
                window["-ERROR-"].update(errorMessage)
                client = values["-CLIENT-"]
                secret = values["-SECRET-"]
                agent = values["-AGENT-"]
                username = values["-USERNAME-"]
                password = values["-PASS-"]
                redditAccount = sign_in(client, secret, agent, username,
                                        password)
                if redditAccount != "Invalid credentials.":
                    errorMessage = "Success!"
                    window["-ERROR-"].update(errorMessage)
                    f = open("credentials.txt")
                    f.write(client + "\n")
                    f.write(secret + "\n")
                    f.write(agent + "\n")
                    f.write(username + "\n")
                    f.write(password)
                    f.close()
                    return redditAccount
                    break
                else:
                    errorMessage = redditAccount
                    window["-ERROR-"].update(errorMessage)
                    redditAccount = ''

            else:
                errorMessage = "Please enter the missing data."
                window["-ERROR-"].update(errorMessage)
예제 #25
0
def row_separator(text, line=False):
    if line:
        return (sg.Text(text, font=ct.SEPARATOR_FONT),
                sg.HSeparator(pad=((5, 18), (4, 2))))
    else:
        return sg.Text(text, font=ct.SEPARATOR_FONT), sg.Text(" ")
예제 #26
0
def make_win1():

    column_one = [[sg.Text("SYSTEMS")],
                  [
                      sg.Listbox(option_list,
                                 enable_events=True,
                                 size=(25, 32),
                                 key=('-LOCATIONS-'))
                  ]]

    column_two = [
        [sg.Text("UWP Categories")],
        [sg.HSeparator()],
    ]
    column_three = [
        [sg.Text("World Details")],
        [sg.HSeparator()],
    ]
    for m in m_labels:
        column_two += [
            sg.Text(m + ':', enable_events=True, key=(m), pad=(0, 0))
        ],
        column_three += [
            sg.Text('|', enable_events=True, key=(m + 'i'), pad=(0, 0))
        ],

    column_two += [
        [sg.Text("System Categories", pad=(5, (15, 2)))],
        [sg.HSeparator()],
    ]
    column_three += [
        [sg.Text("System-wide Details", pad=(5, (15, 2)))],
        [sg.HSeparator()],
    ]

    for s in s_labels:
        column_two += [
            sg.Text(s + ':', enable_events=True, key=(s), pad=(0, 0))
        ],
        column_three += [
            sg.Text('|', enable_events=True, key=(s + 'i'), pad=(0, 0))
        ],

    column_four = [
        [sg.Text("Scientific Categories")],
        [sg.HSeparator()],
    ]
    column_five = [
        [sg.Text("World Details")],
        [sg.HSeparator()],
    ]
    for d in d_labels:
        column_four += [
            sg.Text(d + ':', enable_events=True, key=(d), pad=(0, 0))
        ],
        column_five += [
            sg.Text('|', enable_events=True, key=(d + 'i'), pad=(0, 0))
        ],

    column_four += [
        [sg.Text("Economic Categories", pad=(5, (15, 2)))],
        [sg.HSeparator()],
    ]
    column_five += [
        [sg.Text("System-wide Details", pad=(5, (15, 2)))],
        [sg.HSeparator()],
    ]

    for e in e_labels:
        column_four += [
            sg.Text(e + ':', enable_events=True, key=(e), pad=(0, 0))
        ],
        column_five += [
            sg.Text('|', enable_events=True, key=(e + 'i'), pad=(0, 0))
        ],

    map_options = [
        [
            sg.Radio('Show Selected',
                     '-DISPLAY-',
                     key=('-FULL-'),
                     default=True,
                     pad=(0, 0))
        ],
        [
            sg.Radio('Find Earth Like',
                     '-DISPLAY-',
                     key=('-EARTH-'),
                     pad=(0, 0))
        ],
    ]

    label_options = [
        [
            sg.Radio('Num',
                     '-OVERLAY-',
                     key=('-NUM-'),
                     default=True,
                     pad=(0, 0))
        ],
        [sg.Radio('Name', '-OVERLAY-', key=('-NAME-'), pad=(0, 0))],
    ]

    column_six = [
        [sg.Canvas(key='-CANVAS-')],
        [
            sg.Column(map_options),
            sg.Column(label_options),
            sg.Button('Map', key=('-MAP-'))
        ],
    ]

    #              [sg.Radio('Sector',key=('-SECTOR-')),sg.Button('Earth-like',key=('-EARTH-')),
    #               sg.Button('Subsector'),sg.Button('System'),

    image_layout = []
    for li in list_images:
        filename = os.path.join(folder, li[0] + '.png')
        image_layout += [
            sg.Image(data=get_img_data(filename, first=True),
                     tooltip=li[1],
                     enable_events=True,
                     key=(li[0]))
        ],

    layout = [
        [sg.Text("""Browse Window""")],
        [sg.HSeparator()],
        [
            sg.Text('Choose A Sector',
                    size=(15, 1),
                    auto_size_text=False,
                    justification='right'),
            sg.In(size=(20, 1),
                  enable_events=True,
                  key=('-DB-'),
                  justification='right'),
            sg.FileBrowse(file_types=(("Database Files", "*.db"), ),
                          enable_events=True,
                          initial_folder=("sector_db")),
            sg.VSeparator(),
            sg.Button('Main World', key=('-MAIN-')),
            sg.Button('Full System', key=('-SYSTEM-')),
            sg.VSeparator(),
            sg.Button('Stellar', key=('-STELLAR-')),
            sg.Button('Culture', key=('-CULTURE-')),
            sg.VSeparator(),
            sg.Button('Exit'),
        ],
        [
            sg.HSeparator(),
        ],
        [
            sg.Column(column_one),
            sg.VSeparator(),
            sg.Column(column_two),
            sg.Column(column_three),
            sg.Column(image_layout),
            sg.VSeparator(),
            sg.Column(column_four),
            sg.Column(column_five),
            sg.VSeparator(),
            sg.Column(column_six),
        ],
    ]
    return sg.Window("""Bartleby's Sector Builder""",
                     layout,
                     size=(1200, 700),
                     finalize=True)
예제 #27
0
파일: smsp.py 프로젝트: raphnet/smscprogr
column_leftSide = [
    [   sg.Frame("Operations", layout_operations, expand_x = True) ],
    [   sg.Frame("Programmer", layout_programmer) ],
]

layout_rightSide = [
    [   sg.Frame("Buffer", layout_buffer, expand_y = True, expand_x = True) ],
]

layout = [
    [sg.Text("SMSCPROGR : SMS/Mark-III cartridge reader/programmer", font=("Helvetica", 20)) ],
    [sg.Column(column_leftSide, expand_y=True, expand_x=False),
     sg.VSeparator(),
     sg.Column(layout_rightSide, expand_y=True, expand_x=True),
    ],
    [ sg.HSeparator() ],
    [ sg.Multiline(autoscroll = True, expand_x = True, expand_y = True, size=(80,5),  font=('monospace', 8), key="-LOGS-", write_only = True, disabled = True, reroute_stdout = g_reroute_stdout) ],
    [ sg.Quit() ],
]



def getHexDump(data):
    text = ""

    decoded = ""
    address = 0
    for byte in data:

        if 0 == address % 16:
            if address != 0:
예제 #28
0
def conjugate_fr(verb):
    # todo: add color and participe présent
    '''
    print formated text with conjugation table

    :param verb:
    :return:
    '''

    # List of table for each tense
    table = []

    # Conjugate verb
    w = Conjugator(language='fr').conjugate(verb)

    # Convert to numpy array and change personal noun
    w = w.iterate()
    w_arr = np.full((11, 7, 2),
                    None)  # 11 tenses, 6 personnel noun and tense form

    # w_arr[k, l, 2]
    k = 1  # counter for w_arr

    # Infinitif
    w_arr[0, 1, 0] = w[0][1]
    w_arr[0, 1, 1] = w[0][2]
    # Ind -> Sub
    for i in range(1, 42, 6):
        # tense name
        tmp = list
        w_arr[k, 0, 0] = "{:-<18}".format('')
        w_arr[k, 0, 1] = "{:-<25}".format(w[i][0] + ' ' + w[i][1])
        # personal prenoun
        w_arr[k, 1, 0] = "{:<18}".format('je')
        w_arr[k, 2, 0] = "{:<18}".format('tu')
        w_arr[k, 3, 0] = "{:<18}".format('il/elle/on')
        w_arr[k, 4, 0] = "{:<18}".format('nous')
        w_arr[k, 5, 0] = "{:<18}".format('vous')
        w_arr[k, 6, 0] = "{:<18}".format('ils/elles/ont')
        # tense form
        for j in range(6):
            w_arr[k, j + 1, 1] = "{:<25}".format(w[i + j][3])
        tmp = np.where(w_arr[k, :, :] is None, ' ', w_arr[k, :, :])
        table.append(tabulate(tmp, tablefmt='plain', numalign="center"))
        k += 1
    # Imp présent
    w_arr[k, 0, 0] = "{:-<18}".format('')
    w_arr[k, 0, 1] = "{:-<25}".format(w[43][1])
    w_arr[k, 1, 0] = "{:<18}".format("(tu)")
    w_arr[k, 2, 0] = "{:<18}".format("(nous)")
    w_arr[k, 3, 0] = "{:<18}".format("(vous)")
    for j in range(3):
        w_arr[k, j + 1, 1] = "{:<25}".format(w[43 + j][3])
    tmp = np.where(w_arr[k, :, :] is None, ' ', w_arr[k, :, :])
    table.append(tabulate(tmp, tablefmt='plain', numalign="center"))
    k += 1
    # participe présent
    w_arr[k, 0, 0] = w[46][1]
    w_arr[k, 0, 1] = w[46][2]
    part_pres = w_arr[k, 0, 0] + ' ' + w_arr[k, 0, 1]
    k += 1
    # participe passé
    w_arr[k, 0, 0] = "{:-<18}".format('')
    w_arr[k, 0, 1] = "{:-<25}".format(w[47][1])
    w_arr[k, 1, 0] = "{:<18}".format("masculin singulier")
    w_arr[k, 2, 0] = "{:<18}".format("masculin pluriel")
    w_arr[k, 3, 0] = "{:<18}".format("féminin singulier")
    w_arr[k, 4, 0] = "{:<18}".format("féminin pluriel")
    for j in range(1, 5):
        w_arr[k, j, 1] = "{:<25}".format(w[46 + j][3])
    tmp = np.where(w_arr[k, :, :] is None, ' ', w_arr[k, :, :])
    table.append(tabulate(tmp, tablefmt='plain', numalign="center"))

    # formated sg window
    # participe présent
    col = []
    k = 0
    for i in range(3):
        row = []
        for j in range(3):
            row.extend([
                sg.Text(table[k], font='Courier', text_color='white'),
                sg.VSeparator(color='white')
            ])
            k += 1
        col.append(row)
        col.append([sg.HSeparator(color='white')])

    return col
예제 #29
0
BUTTON_NAME_EXIT = "_EXIT_"
BUTTON_NAME_UPDATE_TIME_SCALING = "_UPDATE_SCALING_"
BUTTON_NAME_UPDATE_TIME_ACCIDENT = "_TIME_ACCIDENT_"
BUTTON_NAME_UPDATE_LINE_LOW_SPEED = "_LINE_LOW_SPEED_"

BUTTON_NAME_ADD_LINE_LOW_SPEED = "_ADD_LINE_LOW_SPEED_"
BUTTON_NAME_DELETE_LINE_LOW_SPEED = "_DELETE_LINE_LOW_SPEED_"

CHECK_BOX_NAME_RANDOM_SLOW_DAWN = "_NEED_RANDOM_SLOW_DAWN_"

# ---------------------------------------------------------------------- #
#                           LAYOUT                                       #
# ---------------------------------------------------------------------- #

LAYOUT = [
    [sg.Text('Задайте необходимые параметры эксперимента')], [sg.HSeparator()],
    [
        sg.Text('Длина полосы (км):', size=(55, 1)),
        sg.InputText('1', size=(10, 1), key=TEXT_NAME_LENGTH_LANE)
    ],
    [
        sg.Text('Скорость автомобилей от (км/ч):', size=(55, 1)),
        sg.InputText('60', size=(10, 1), key=TEXT_NAME_SPEED_START),
        sg.Text(text='до(км/ч):', size=(8, 1)),
        sg.InputText('150', size=(10, 1), key=TEXT_NAME_SPEED_END)
    ],
    [
        sg.Text('Частота искусственного замедления автомобилей от (сек.):',
                size=(55, 1)),
        sg.InputText('2', size=(10, 1), key=TEXT_NAME_TIME_LOW_SPEED_START),
        sg.Text(text='до (сек.):', size=(8, 1)),
예제 #30
0
    sg.In(size=(25, 1), enable_events=True, key='-FOLDER-'),
    sg.FolderBrowse()
],
           [
               sg.Text("URL", key='-url-'),
               sg.In(size=(25, 1), enable_events=True, key='-URL-'),
               sg.Button('check', key='-check-')
           ]]
resume = [[sg.Text("INFO:", visible=True, font=12)],
          [
              sg.Text(text="",
                      key='-info-',
                      auto_size_text=True,
                      size=(20, 20),
                      font=10)
          ], [sg.HSeparator()], [sg.Button('dowload', key='-DOWNLOAD-')],
          [
              sg.ProgressBar(100,
                             orientation='h',
                             size=(20, 20),
                             key='-PROGRESS_BAR-')
          ]]

#layout
layout = [[
    sg.Column(options),
    sg.VSeparator(),
    sg.Column(resume, justification='center')
]]

# Create the window