# Path: ui/ui_main.py
# class Ui_Form(object):
#     def setupUi(self, Form):
#         Form.setObjectName("Form")
#         Form.resize(830, 333)
#         Form.setMinimumSize(QtCore.QSize(700, 300))
#         self.gridLayout = QtWidgets.QGridLayout(Form)
#         self.gridLayout.setObjectName("gridLayout")
#         self.verticalLayout = QtWidgets.QVBoxLayout()
#         self.verticalLayout.setSpacing(20)
#         self.verticalLayout.setObjectName("verticalLayout")
#         self.listView = QtWidgets.QListView(Form)
#         self.listView.setObjectName("listView")
#         self.verticalLayout.addWidget(self.listView)
#         self.horizontalLayout = QtWidgets.QHBoxLayout()
#         self.horizontalLayout.setSpacing(30)
#         self.horizontalLayout.setObjectName("horizontalLayout")
#         self.pushButton = QtWidgets.QPushButton(Form)
#         self.pushButton.setMinimumSize(QtCore.QSize(0, 50))
#         self.pushButton.setObjectName("pushButton")
#         self.horizontalLayout.addWidget(self.pushButton)
#         self.pushButton_2 = QtWidgets.QPushButton(Form)
#         self.pushButton_2.setMinimumSize(QtCore.QSize(0, 50))
#         self.pushButton_2.setMaximumSize(QtCore.QSize(230, 16777215))
#         self.pushButton_2.setObjectName("pushButton_2")
#         self.horizontalLayout.addWidget(self.pushButton_2)
#         self.verticalLayout.addLayout(self.horizontalLayout)
#         self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)
# 
#         self.retranslateUi(Form)
#         self.listView.clicked['QModelIndex'].connect(Form.key_selected)
#         self.pushButton.clicked.connect(Form.enter)
#         self.pushButton_2.clicked.connect(Form.not_use_key)
#         QtCore.QMetaObject.connectSlotsByName(Form)
# 
#     def retranslateUi(self, Form):
#         _translate = QtCore.QCoreApplication.translate
#         Form.setWindowTitle(_translate("Form", "使用する鍵を選択"))
#         self.pushButton.setText(_translate("Form", "決定"))
#         self.pushButton_2.setText(_translate("Form", "鍵を使わない"))


import os
import sys
from ui.ui_main import Ui_Form
from PyQt5 import QtGui, QtCore
from subprocess import DEVNULL, STDOUT, check_call
from PyQt5.QtWidgets import QApplication, QWidget
from typing import List, Tuple, Optional
        self.ui.setupUi(self)
        self.setWindowTitle("ADX用鍵を選択")
        self.read_file(self.keyFile)

    def key_selected(self, index):
        self.selectedRow = index.row()
        self.note = self.keys[self.selectedRow]

    def read_file(self, file: str):
        with open(file, 'r', encoding='shift_jis') as f:
            for line in f:
                lis = line.split(' : ')
                if len(lis) != 2:
                    continue
                key = (lis[1], lis[0])
                self.keys.append(key)
        self.ui.model = QtGui.QStandardItemModel(self.ui.listView)
        for key in self.keys:
            item = QtGui.QStandardItem(key[0].rstrip('\n'))
            self.ui.model.appendRow(item)
        self.ui.listView.setModel(self.ui.model)

    def enter(self):
        if self.note is None:
            msg = QMessageBox()
            message = "デフォルト鍵を使用します。"
            msg = msg.information(self, 'info', message,  QMessageBox.Ok, QMessageBox.Ok)
            if msg != QMessageBox.Ok:
                return
            self.key = self.key_default

# Path: ui/ui_main.py
# class Ui_Form(object):
#     def setupUi(self, Form):
#         Form.setObjectName("Form")
#         Form.resize(830, 333)
#         Form.setMinimumSize(QtCore.QSize(700, 300))
#         self.gridLayout = QtWidgets.QGridLayout(Form)
#         self.gridLayout.setObjectName("gridLayout")
#         self.verticalLayout = QtWidgets.QVBoxLayout()
#         self.verticalLayout.setSpacing(20)
#         self.verticalLayout.setObjectName("verticalLayout")
#         self.listView = QtWidgets.QListView(Form)
#         self.listView.setObjectName("listView")
#         self.verticalLayout.addWidget(self.listView)
#         self.horizontalLayout = QtWidgets.QHBoxLayout()
#         self.horizontalLayout.setSpacing(30)
#         self.horizontalLayout.setObjectName("horizontalLayout")
#         self.pushButton = QtWidgets.QPushButton(Form)
#         self.pushButton.setMinimumSize(QtCore.QSize(0, 50))
#         self.pushButton.setObjectName("pushButton")
#         self.horizontalLayout.addWidget(self.pushButton)
#         self.pushButton_2 = QtWidgets.QPushButton(Form)
#         self.pushButton_2.setMinimumSize(QtCore.QSize(0, 50))
#         self.pushButton_2.setMaximumSize(QtCore.QSize(230, 16777215))
#         self.pushButton_2.setObjectName("pushButton_2")
#         self.horizontalLayout.addWidget(self.pushButton_2)
#         self.verticalLayout.addLayout(self.horizontalLayout)
#         self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)
# 
#         self.retranslateUi(Form)
#         self.listView.clicked['QModelIndex'].connect(Form.key_selected)
#         self.pushButton.clicked.connect(Form.enter)
#         self.pushButton_2.clicked.connect(Form.not_use_key)
#         QtCore.QMetaObject.connectSlotsByName(Form)
# 
#     def retranslateUi(self, Form):
#         _translate = QtCore.QCoreApplication.translate
#         Form.setWindowTitle(_translate("Form", "使用する鍵を選択"))
#         self.pushButton.setText(_translate("Form", "決定"))
#         self.pushButton_2.setText(_translate("Form", "鍵を使わない"))


# Path: window/window_adxKeySelect.py
import os
import sys
from ui.ui_main import Ui_Form
from PyQt5 import QtGui, QtCore
from subprocess import DEVNULL, STDOUT, check_call
from PyQt5.QtWidgets import QApplication, QWidget
from typing import List, Tuple, Optional

        self.ui.setupUi(self)
        self.setWindowTitle("ADX用鍵を選択")
        self.read_file(self.keyFile)

    def key_selected(self, index):
        self.selectedRow = index.row()
        self.note = self.keys[self.selectedRow]

    def read_file(self, file: str):
        with open(file, 'r', encoding='shift_jis') as f:
            for line in f:
                lis = line.split(' : ')
                if len(lis) != 2:
                    continue
                key = (lis[1], lis[0])
                self.keys.append(key)
        self.ui.model = QtGui.QStandardItemModel(self.ui.listView)
        for key in self.keys:
            item = QtGui.QStandardItem(key[0].rstrip('\n'))
            self.ui.model.appendRow(item)
        self.ui.listView.setModel(self.ui.model)

    def enter(self):
        if self.note is None:
            msg = QMessageBox()
            message = "デフォルト鍵を使用します。"
            msg = msg.information(self, 'info', message,  QMessageBox.Ok, QMessageBox.Ok)
            if msg != QMessageBox.Ok:
                return
            self.key = self.key_default

        else: