def load_new_rules(self): self.logger = Syslogger("FWBUILDER-AHTAPOT", '%(name)s %(levelname)s %(message)s', "/dev/log", self.current_user) self.filelogger = Filelogger( "FWBUILDER-AHTAPOT", '%(asctime)s %(name)s %(levelname)s %(message)s', "/var/log/ahtapot/gdys-gui.log", "a", self.current_user) self.lbl_error_start.setText("<p></p>") if start_fw.check_if_runs() is True: self.warn_if_fw_runs() else: self.progressBar.setVisible(True) self.centralwidget.setEnabled(False) self.set_progressbar() abs_path = os.path.abspath(__file__) path_list = abs_path.split("/") del path_list[-1] path_name = "/".join(path_list) full_path = path_name + "/" self.pull_repo() self.logger.send_log( "warning", " Rule Settings pulled from Master and Firewall Builder Started" ) self.filelogger.send_log( "warning", " Rule Settings pulled from Master and Firewall Builder Started" ) self.centralwidget.setEnabled(True) self.progressBar.setValue(0) self.progressBar.setVisible(False)
def kill_all(self): self.logger = Syslogger("FWBUILDER-AHTAPOT", '%(name)s %(levelname)s %(message)s', "/dev/log", self.current_user) self.filelogger = Filelogger( "FWBUILDER-AHTAPOT", '%(asctime)s %(name)s %(levelname)s %(message)s', "/var/log/ahtapot/gdys-gui.log", "a", self.current_user) start_fw.kill_fw() try: start_fw.kill_gui_user(self.current_user) except Exception as e: self.filelogger.send_log( "error", "Error While Killing Previous GUI {}".format(str(e))) abs_path = os.path.abspath(__file__) path_list = abs_path.split("/") del path_list[-1] path_name = "/".join(path_list) full_path = path_name + "/" with open(full_path + "current_user.dmr", "w") as current_user: current_user.write(self.current_user) self.filelogger.send_log( "warning", " previous gui was killed by " + self.current_user + " : gui ") self.btn_kill_fw.setEnabled(False) sleep(2) self.load_new_rules() sleep(3) self.auto_refresh() self.lbl_error_start.setText(u"<b>SONLANDIRILDI</b>")
def start_fwbuilder(self): self.logger = Syslogger("FWBUILDER-AHTAPOT", '%(name)s %(levelname)s %(message)s', "/dev/log", self.current_user) self.filelogger = Filelogger( "FWBUILDER-AHTAPOT", '%(asctime)s %(name)s %(levelname)s %(message)s', "/var/log/ahtapot/gdys-gui.log", "a", self.current_user) self.lbl_error_start.setText("<p></p>") if start_fw.check_if_runs() == False: with open(self.full_path + "current_user.dmr", "w") as current_user: current_user.write(self.current_user) fw_path = CP.get_configs()["fw_path"] start_fw.start_fwbuilder(self.git) self.logger.send_log( "info", " Firewall Builder Started with Local settings") self.filelogger.send_log( "info", " Firewall Builder Started with Local settings") else: self.warn_if_fw_runs() subprocess.call([ "xdotool search --name \"Firewall Builder\" windowactivate windowsize 90\% 90\%" ], shell=True)
def get_file_list(self): self.logger = Syslogger("FWBUILDER-AHTAPOT", '%(name)s %(levelname)s %(message)s', "/dev/log", self.current_user) self.filelogger = Filelogger( "FWBUILDER-AHTAPOT", '%(asctime)s %(name)s %(levelname)s %(message)s', "/var/log/ahtapot/gdys-gui.log", "a", self.current_user) fw_path = CP.get_path_configs()["fw_path"] files = [] fwb_list = [] for (dirpath, dirnames, file_names) in os.walk(fw_path): files.extend(file_names) break for f in files: f_name, f_extension = os.path.splitext(f) if f_extension == ".fwb": fwb_list.append(str(f)) if len(fwb_list) != 0: self.cmb_fw_file_name.addItems(fwb_list) fwb_file_name = CP.get_path_configs()["fwb_file_name"] index = self.cmb_fw_file_name.findText(str(fwb_file_name)) if index != -1: self.cmb_fw_file_name.setCurrentIndex(index)
def save_config_gitlab(self): self.logger = Syslogger("FWBUILDER-AHTAPOT", '%(name)s %(levelname)s %(message)s', "/dev/log", self.current_user) self.filelogger = Filelogger( "FWBUILDER-AHTAPOT", '%(asctime)s %(name)s %(levelname)s %(message)s', "/var/log/ahtapot/gdys-gui.log", "a", self.current_user) config_gitlab = {} config_gitlab["url"] = self.ledit_gitlab_url.text() config_gitlab["user"] = self.ledit_gitlab_user.text() config_gitlab["pass"] = self.ledit_gitlab_pass.text() config_gitlab["confirm_branch"] = self.ledit_confirm_branch.text() config_gitlab["master_branch"] = self.ledit_master_branch.text() config_gitlab["project_name"] = self.ledit_project_name.text() self.progressBar_gitlab.setVisible(True) self.centralwidget.setEnabled(False) self.set_progressbar(self.progressBar_gitlab) CP.set_gitlab_config(config_gitlab) self.logger.send_log("warning", " gitlab configs changed") self.filelogger.send_log("warning", " gitlab configs changed") result = self.check_and_refresh() self.centralwidget.setEnabled(True) self.progressBar_gitlab.setValue(0) self.progressBar_gitlab.setVisible(False) if result == True: self.lbl_error_message.setText( u"<p>Ayarlarınız başarılı bir şekilde kaydedildi.</p>")
def save_config_path(self): self.logger = Syslogger("FWBUILDER-AHTAPOT", '%(name)s %(levelname)s %(message)s', "/dev/log", self.current_user) self.filelogger = Filelogger( "FWBUILDER-AHTAPOT", '%(asctime)s %(name)s %(levelname)s %(message)s', "/var/log/ahtapot/gdys-gui.log", "a", self.current_user) config_paths = {} config_paths["fwb_file_name"] = str( self.cmb_fw_file_name.currentText()) config_paths["fw_copy_path"] = self.ledit_fw_copy_path.text() config_paths["poc_user"] = self.ledit_poc_user.text() config_paths["poc_ip"] = self.ledit_poc_ip.text() config_paths["port_number"] = self.ledit_poc_port_number.text() config_paths["poc_copy_location"] = self.ledit_poc_copy_path.text() config_paths["std_out_err"] = self.ledit_std_out_err.text() self.progressBar_path.setVisible(True) self.centralwidget.setEnabled(False) self.set_progressbar(self.progressBar_path) CP.set_path_config(config_paths) self.logger.send_log("warning", " path configs changed") self.filelogger.send_log("warning", " path configs changed") result = self.check_and_refresh() self.centralwidget.setEnabled(True) self.progressBar_path.setValue(0) self.progressBar_path.setVisible(False) if result == True: self.lbl_error_message.setText( u"<p>Ayarlarınız başarılı bir şekilde kaydedildi.</p>")
def load_new_rules(self): self.logger = Syslogger("FWBUILDER-AHTAPOT", '%(name)s %(levelname)s %(message)s', "/dev/log", self.current_user) self.filelogger = Filelogger( "FWBUILDER-AHTAPOT", '%(asctime)s %(name)s %(levelname)s %(message)s', "/var/log/ahtapot/gdys-gui.log", "a", self.current_user) self.lbl_error_start.setText("<p></p>") if GC.check_mergerequest( self.git, CP.get_configs()["gitlab_project_id"]) == False: self.refresh_method() elif start_fw.check_if_runs() is True: self.warn_if_fw_runs() else: self.progressBar.setVisible(True) self.centralwidget.setEnabled(False) self.set_progressbar() abs_path = os.path.abspath(__file__) path_list = abs_path.split("/") del path_list[-1] path_name = "/".join(path_list) full_path = path_name + "/" if os.path.exists(full_path + "onay.dmr"): os.remove(full_path + "onay.dmr") self.pull_repo() self.logger.send_log( "warning", " Rule Settings pulled from Master and Firewall Builder Started" ) self.filelogger.send_log( "warning", " Rule Settings pulled from Master and Firewall Builder Started" ) self.lbl_merge_control.setText(u"<p></p>") self.centralwidget.setEnabled(True) self.progressBar.setValue(0) self.progressBar.setVisible(False)
abs_path = os.path.abspath(__file__) path_list = abs_path.split("/") del path_list[-1] path_name = "/".join(path_list) full_path = path_name + "/" if os.path.exists(full_path + "current_user.dmr"): with open(full_path + "current_user.dmr") as current_user: user = current_user.readline() else: user = subprocess.check_output(["whoami"]) logger = Syslogger("FWBUILDER-AHTAPOT", '%(name)s %(levelname)s %(message)s', "/dev/log", user) filelogger = Filelogger("FWBUILDER-AHTAPOT", '%(asctime)s %(name)s %(levelname)s %(message)s', "/var/log/ahtapot/gdys-gui.log", "a", user) def gitlab_connect(gitlab_url, user, password): git = gitlab.Gitlab(gitlab_url) git.login(user=user, password=password) return git def check_mergerequest(git, project_id): sleep(1) mergerequests = git.getmergerequests(project_id) if mergerequests != False: for merge in mergerequests: if merge["state"] == "opened" or merge["state"] == "reopened":
def setupUi(self, FwStartWindow): FwStartWindow.setObjectName(_fromUtf8("FwStartWindow")) FwStartWindow.move(200, 100) FwStartWindow.resize(800, 600) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( FwStartWindow.sizePolicy().hasHeightForWidth()) FwStartWindow.setSizePolicy(sizePolicy) FwStartWindow.setMinimumSize(QtCore.QSize(800, 600)) FwStartWindow.setMaximumSize(QtCore.QSize(800, 600)) FwStartWindow.setStyleSheet( _fromUtf8("background-color: rgb(255, 236, 207);")) self.centralwidget = QtGui.QWidget(FwStartWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.btn_deny_control = QtGui.QPushButton(self.centralwidget) self.btn_deny_control.setGeometry(QtCore.QRect(340, 430, 181, 50)) self.frame = QtGui.QFrame(self.centralwidget) self.frame.setGeometry(QtCore.QRect(490, 120, 301, 181)) self.frame.setFrameShape(QtGui.QFrame.StyledPanel) self.frame.setFrameShadow(QtGui.QFrame.Raised) self.frame.setObjectName(_fromUtf8("frame")) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.btn_deny_control.sizePolicy().hasHeightForWidth()) self.btn_deny_control.setSizePolicy(sizePolicy) self.btn_deny_control.setMinimumSize(QtCore.QSize(160, 50)) self.btn_deny_control.setAcceptDrops(False) self.btn_deny_control.setStyleSheet( _fromUtf8("background-color: rgb(159, 173, 176);")) self.btn_deny_control.setObjectName(_fromUtf8("btn_deny_control")) self.btn_start_fwbuilder = QtGui.QPushButton(self.centralwidget) self.btn_start_fwbuilder.setGeometry(QtCore.QRect(150, 430, 181, 50)) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.btn_start_fwbuilder.sizePolicy().hasHeightForWidth()) self.btn_start_fwbuilder.setSizePolicy(sizePolicy) self.btn_start_fwbuilder.setMinimumSize(QtCore.QSize(160, 50)) self.btn_start_fwbuilder.setStyleSheet( _fromUtf8("background-color: rgb(159, 173, 176);")) self.btn_start_fwbuilder.setObjectName( _fromUtf8("btn_start_fwbuilder")) self.lbl_last_merge = QtGui.QLabel(self.centralwidget) self.lbl_last_merge.setGeometry(QtCore.QRect(240, 530, 505, 41)) self.lbl_last_merge.setAlignment(QtCore.Qt.AlignBottom | QtCore.Qt.AlignRight) font = QtGui.QFont() font.setBold(False) font.setWeight(50) self.lbl_last_merge.setFont(font) self.lbl_last_merge.setStyleSheet(_fromUtf8("color: rgb(0, 0, 0);")) self.lbl_last_merge.setText(_fromUtf8("")) self.lbl_last_merge.setObjectName(_fromUtf8("lbl_last_merge")) self.lbl_error_start = QtGui.QLabel(self.centralwidget) self.lbl_error_start.setGeometry(QtCore.QRect(20, 260, 375, 41)) font = QtGui.QFont() font.setBold(False) font.setWeight(50) self.lbl_error_start.setFont(font) self.lbl_error_start.setStyleSheet(_fromUtf8("color: rgb(0, 0, 0);")) self.lbl_error_start.setText(_fromUtf8("")) self.lbl_error_start.setObjectName(_fromUtf8("lbl_error_start")) self.btn_kill_fw = QtGui.QPushButton(self.centralwidget) self.btn_kill_fw.setGeometry(QtCore.QRect(10, 300, 51, 50)) self.btn_kill_fw.setMinimumSize(QtCore.QSize(120, 50)) self.btn_kill_fw.setAcceptDrops(False) self.btn_kill_fw.setStyleSheet( _fromUtf8("background-color: rgb(159, 173, 176);")) self.btn_kill_fw.setObjectName(_fromUtf8("btn_kill_fw")) self.btn_kill_fw.setEnabled(False) self.btn_watch_merge = QtGui.QPushButton(self.centralwidget) self.btn_watch_merge.setGeometry(QtCore.QRect(530, 430, 181, 50)) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.btn_watch_merge.sizePolicy().hasHeightForWidth()) self.btn_watch_merge.setSizePolicy(sizePolicy) self.btn_watch_merge.setMinimumSize(QtCore.QSize(160, 50)) self.btn_watch_merge.setAcceptDrops(False) self.btn_watch_merge.setStyleSheet( _fromUtf8("background-color: rgb(159, 173, 176);")) self.btn_watch_merge.setObjectName(_fromUtf8("btn_watch_merge")) self.progressBar = QtGui.QProgressBar(self.centralwidget) self.progressBar.setGeometry(QtCore.QRect(120, 10, 571, 31)) self.progressBar.setVisible(False) font = QtGui.QFont() font.setBold(False) font.setWeight(50) self.progressBar.setFont(font) self.progressBar.setStyleSheet(_fromUtf8("")) self.progressBar.setProperty("value", 0) self.progressBar.setObjectName(_fromUtf8("progressBar")) self.btn_merge_control = QtGui.QPushButton(self.centralwidget) self.btn_merge_control.setGeometry(QtCore.QRect(580, 60, 181, 50)) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.btn_merge_control.sizePolicy().hasHeightForWidth()) self.btn_merge_control.setSizePolicy(sizePolicy) self.btn_merge_control.setMinimumSize(QtCore.QSize(160, 50)) self.btn_merge_control.setStyleSheet( _fromUtf8("background-color: rgb(159, 173, 176);")) self.btn_merge_control.setObjectName(_fromUtf8("btn_merge_control")) self.lbl_merge_control = QtGui.QLabel(self.frame) self.lbl_merge_control.setGeometry(QtCore.QRect(1, 1, 300, 180)) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.lbl_merge_control.sizePolicy().hasHeightForWidth()) self.lbl_merge_control.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setFamily(_fromUtf8("Sans Serif")) font.setPointSize(9) font.setBold(False) font.setItalic(False) font.setWeight(50) font.setStrikeOut(False) font.setStyleStrategy(QtGui.QFont.PreferDefault) self.lbl_merge_control.setFont(font) self.lbl_merge_control.setAutoFillBackground(False) self.lbl_merge_control.setStyleSheet(_fromUtf8("color: rgb(0, 0, 0);")) self.lbl_merge_control.setLocale( QtCore.QLocale(QtCore.QLocale.Turkish, QtCore.QLocale.Turkey)) self.lbl_merge_control.setObjectName(_fromUtf8("lbl_merge_control")) FwStartWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(FwStartWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 22)) self.menubar.setStyleSheet(_fromUtf8("")) self.menubar.setObjectName(_fromUtf8("menubar")) self.menu_edit = QtGui.QMenu(self.menubar) self.menu_edit.setObjectName(_fromUtf8("menu_edit")) self.menu_help = QtGui.QMenu(self.menubar) self.menu_help.setObjectName(_fromUtf8("menu_help")) FwStartWindow.setMenuBar(self.menubar) self.action_refresh = QtGui.QAction(FwStartWindow) self.action_refresh.setObjectName(_fromUtf8("action_refresh")) self.action_settings = QtGui.QAction(FwStartWindow) self.action_settings.setObjectName(_fromUtf8("action_settings")) self.action_definitions = QtGui.QAction(FwStartWindow) self.action_definitions.setObjectName(_fromUtf8("action_definitions")) self.action_about = QtGui.QAction(FwStartWindow) self.action_about.setObjectName(_fromUtf8("action_about")) self.action_exit = QtGui.QAction(FwStartWindow) self.action_exit.setObjectName(_fromUtf8("action_exit")) self.menu_edit.addAction(self.action_refresh) self.menu_edit.addAction(self.action_settings) self.menu_edit.addAction(self.action_exit) self.menu_help.addAction(self.action_definitions) self.menu_help.addAction(self.action_about) self.menubar.addAction(self.menu_edit.menuAction()) self.menubar.addAction(self.menu_help.menuAction()) self.timer = QtCore.QTimer() self.timer.timeout.connect(self.auto_refresh) self.def_window = None self.about_window = None self.retranslateUi(FwStartWindow) self.git = False self.git_status = False self.child = False self.old_config = {} self.active_user = "******" self.current_user = "******" abs_path = os.path.abspath(__file__) path_list = abs_path.split("/") del path_list[-1] path_name = "/".join(path_list) full_path = path_name + "/" with open(full_path + "current_user.dmr", "r") as current_user: self.active_user = current_user.readline() self.full_path = full_path self.logger = Syslogger("FWBUILDER-AHTAPOT", '%(name)s %(levelname)s %(message)s', "/dev/log", self.current_user) self.filelogger = Filelogger( "FWBUILDER-AHTAPOT", '%(asctime)s %(name)s %(levelname)s %(message)s', "/var/log/ahtapot/gdys-gui.log", "a", self.current_user) #stylesheets FwStartWindow.setStyleSheet( _fromUtf8("QMainWindow#FwStartWindow {border-image: url(" + full_path + "img/ahtapot_logo.png);}")) self.set_confirmation_status() QtCore.QObject.connect(self.action_settings, QtCore.SIGNAL(_fromUtf8("triggered()")), self.change_windows) QtCore.QObject.connect(self.action_exit, QtCore.SIGNAL(_fromUtf8("triggered()")), exit) QtCore.QObject.connect(self.action_refresh, QtCore.SIGNAL(_fromUtf8("triggered()")), self.refresh_method) QtCore.QObject.connect(self.action_definitions, QtCore.SIGNAL(_fromUtf8("triggered()")), self.show_def_window) QtCore.QObject.connect(self.action_about, QtCore.SIGNAL(_fromUtf8("triggered()")), self.show_about_window) QtCore.QObject.connect(self.btn_start_fwbuilder, QtCore.SIGNAL(_fromUtf8("clicked()")), self.start_fwbuilder) QtCore.QObject.connect(self.btn_merge_control, QtCore.SIGNAL(_fromUtf8("clicked()")), self.check_git_merge) QtCore.QObject.connect(self.btn_deny_control, QtCore.SIGNAL(_fromUtf8("clicked()")), self.load_new_rules) QtCore.QObject.connect(self.btn_watch_merge, QtCore.SIGNAL(_fromUtf8("clicked()")), self.watch_new_rules) QtCore.QObject.connect(self.btn_kill_fw, QtCore.SIGNAL(_fromUtf8("clicked()")), self.kill_all) QtCore.QMetaObject.connectSlotsByName(FwStartWindow)
def setupUi(self, FwSettingsWindow): FwSettingsWindow.setObjectName(_fromUtf8("FwSettingsWindow")) FwSettingsWindow.move(250, 150) FwSettingsWindow.resize(740, 530) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( FwSettingsWindow.sizePolicy().hasHeightForWidth()) FwSettingsWindow.setSizePolicy(sizePolicy) FwSettingsWindow.setMinimumSize(QtCore.QSize(740, 530)) FwSettingsWindow.setMaximumSize(QtCore.QSize(740, 530)) FwSettingsWindow.setStyleSheet( _fromUtf8("background-color: rgb(255, 236, 207);")) self.centralwidget = QtGui.QWidget(FwSettingsWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.tabWidget = QtGui.QTabWidget(self.centralwidget) self.tabWidget.setGeometry(QtCore.QRect(20, 90, 711, 401)) self.tabWidget.setObjectName(_fromUtf8("tabWidget")) self.tab_path = QtGui.QWidget() self.tab_path.setEnabled(False) self.tab_path.setObjectName(_fromUtf8("tab_path")) self.btn_config_save = QtGui.QPushButton(self.tab_path) self.btn_config_save.setGeometry(QtCore.QRect(550, 280, 101, 41)) self.btn_config_save.setStyleSheet( _fromUtf8("background-color: rgb(159, 173, 176);")) self.btn_config_save.setObjectName(_fromUtf8("btn_config_save")) self.layoutWidget = QtGui.QWidget(self.tab_path) self.layoutWidget.setGeometry(QtCore.QRect(20, 20, 631, 281)) self.layoutWidget.setObjectName(_fromUtf8("layoutWidget")) self.horizontalLayout = QtGui.QHBoxLayout(self.layoutWidget) self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.verticalLayout_2 = QtGui.QVBoxLayout() self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.label_13 = QtGui.QLabel(self.layoutWidget) self.label_13.setObjectName(_fromUtf8("label_13")) self.verticalLayout_2.addWidget(self.label_13) self.label_2 = QtGui.QLabel(self.layoutWidget) self.label_2.setObjectName(_fromUtf8("label_2")) self.verticalLayout_2.addWidget(self.label_2) self.label_12 = QtGui.QLabel(self.layoutWidget) self.label_12.setObjectName(_fromUtf8("label_12")) self.verticalLayout_2.addWidget(self.label_12) self.label_3 = QtGui.QLabel(self.layoutWidget) self.label_3.setObjectName(_fromUtf8("label_3")) self.verticalLayout_2.addWidget(self.label_3) self.label_4 = QtGui.QLabel(self.layoutWidget) self.label_4.setObjectName(_fromUtf8("label_4")) self.verticalLayout_2.addWidget(self.label_4) self.label_5 = QtGui.QLabel(self.layoutWidget) self.label_5.setObjectName(_fromUtf8("label_5")) self.verticalLayout_2.addWidget(self.label_5) self.horizontalLayout.addLayout(self.verticalLayout_2) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.cmb_fw_file_name = QtGui.QComboBox(self.layoutWidget) self.cmb_fw_file_name.setStyleSheet( _fromUtf8("background-color: rgb(255, 255, 255);")) self.cmb_fw_file_name.setObjectName(_fromUtf8("cmb_fw_file_name")) self.verticalLayout.addWidget(self.cmb_fw_file_name) self.ledit_fw_copy_path = QtGui.QLineEdit(self.layoutWidget) self.ledit_fw_copy_path.setStyleSheet( _fromUtf8("background-color: rgb(255, 255, 255);")) self.ledit_fw_copy_path.setObjectName(_fromUtf8("ledit_fw_copy_path")) self.verticalLayout.addWidget(self.ledit_fw_copy_path) self.ledit_std_out_err = QtGui.QLineEdit(self.layoutWidget) self.ledit_std_out_err.setStyleSheet( _fromUtf8("background-color: rgb(255, 255, 255);")) self.ledit_std_out_err.setObjectName(_fromUtf8("ledit_std_out_err")) self.verticalLayout.addWidget(self.ledit_std_out_err) self.ledit_poc_ip = QtGui.QLineEdit(self.layoutWidget) self.ledit_poc_ip.setStyleSheet( _fromUtf8("background-color: rgb(255, 255, 255);")) self.ledit_poc_ip.setObjectName(_fromUtf8("ledit_poc_ip")) self.verticalLayout.addWidget(self.ledit_poc_ip) self.ledit_poc_user = QtGui.QLineEdit(self.layoutWidget) self.ledit_poc_user.setStyleSheet( _fromUtf8("background-color: rgb(255, 255, 255);")) self.ledit_poc_user.setObjectName(_fromUtf8("ledit_poc_user")) self.verticalLayout.addWidget(self.ledit_poc_user) self.ledit_poc_copy_path = QtGui.QLineEdit(self.layoutWidget) self.ledit_poc_copy_path.setStyleSheet( _fromUtf8("background-color: rgb(255, 255, 255);")) self.ledit_poc_copy_path.setObjectName( _fromUtf8("ledit_poc_copy_path")) self.verticalLayout.addWidget(self.ledit_poc_copy_path) self.ledit_poc_port_number = QtGui.QLineEdit(self.layoutWidget) self.ledit_poc_port_number.setStyleSheet( _fromUtf8("background-color: rgb(255, 255, 255);")) self.ledit_poc_port_number.setObjectName( _fromUtf8("ledit_poc_port_number")) self.verticalLayout.addWidget(self.ledit_poc_port_number) self.horizontalLayout.addLayout(self.verticalLayout) self.progressBar_path = QtGui.QProgressBar(self.tab_path) self.progressBar_path.setGeometry(QtCore.QRect(40, 320, 501, 31)) self.progressBar_path.setVisible(False) font = QtGui.QFont() font.setBold(False) font.setWeight(50) self.progressBar_path.setFont(font) self.progressBar_path.setStyleSheet(_fromUtf8("")) self.progressBar_path.setProperty("value", 0) self.progressBar_path.setObjectName(_fromUtf8("progressBar_path")) self.tabWidget.addTab(self.tab_path, _fromUtf8("")) self.tab_gitlab = QtGui.QWidget() self.tab_gitlab.setEnabled(False) self.tab_gitlab.setObjectName(_fromUtf8("tab_gitlab")) self.layoutWidget_2 = QtGui.QWidget(self.tab_gitlab) self.layoutWidget_2.setGeometry(QtCore.QRect(30, 30, 641, 271)) self.layoutWidget_2.setObjectName(_fromUtf8("layoutWidget_2")) self.horizontalLayout_3 = QtGui.QHBoxLayout(self.layoutWidget_2) self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) self.horizontalLayout_4 = QtGui.QHBoxLayout() self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4")) self.verticalLayout_5 = QtGui.QVBoxLayout() self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5")) self.label_11 = QtGui.QLabel(self.layoutWidget_2) self.label_11.setObjectName(_fromUtf8("label_11")) self.verticalLayout_5.addWidget(self.label_11) self.label_15 = QtGui.QLabel(self.layoutWidget_2) self.label_15.setObjectName(_fromUtf8("label_15")) self.verticalLayout_5.addWidget(self.label_15) self.label_16 = QtGui.QLabel(self.layoutWidget_2) self.label_16.setObjectName(_fromUtf8("label_16")) self.verticalLayout_5.addWidget(self.label_16) self.label_17 = QtGui.QLabel(self.layoutWidget_2) self.label_17.setObjectName(_fromUtf8("label_17")) self.verticalLayout_5.addWidget(self.label_17) self.label_18 = QtGui.QLabel(self.layoutWidget_2) self.label_18.setObjectName(_fromUtf8("label_18")) self.verticalLayout_5.addWidget(self.label_18) self.label_19 = QtGui.QLabel(self.layoutWidget_2) self.label_19.setObjectName(_fromUtf8("label_19")) self.verticalLayout_5.addWidget(self.label_19) self.label_20 = QtGui.QLabel(self.layoutWidget_2) self.label_20.setObjectName(_fromUtf8("label_20")) self.verticalLayout_2.addWidget(self.label_20) self.horizontalLayout_4.addLayout(self.verticalLayout_5) self.verticalLayout_6 = QtGui.QVBoxLayout() self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6")) self.ledit_gitlab_url = QtGui.QLineEdit(self.layoutWidget_2) self.ledit_gitlab_url.setStyleSheet( _fromUtf8("background-color: rgb(255, 255, 255);")) self.ledit_gitlab_url.setObjectName(_fromUtf8("ledit_gitlab_url")) self.verticalLayout_6.addWidget(self.ledit_gitlab_url) self.ledit_gitlab_user = QtGui.QLineEdit(self.layoutWidget_2) self.ledit_gitlab_user.setStyleSheet( _fromUtf8("background-color: rgb(255, 255, 255);")) self.ledit_gitlab_user.setObjectName(_fromUtf8("ledit_gitlab_user")) self.verticalLayout_6.addWidget(self.ledit_gitlab_user) self.ledit_gitlab_pass = QtGui.QLineEdit(self.layoutWidget_2) self.ledit_gitlab_pass.setStyleSheet( _fromUtf8("background-color: rgb(255, 255, 255);")) self.ledit_gitlab_pass.setObjectName(_fromUtf8("ledit_gitlab_pass")) self.ledit_gitlab_pass.setEchoMode(QtGui.QLineEdit.Password) self.verticalLayout_6.addWidget(self.ledit_gitlab_pass) self.ledit_confirm_branch = QtGui.QLineEdit(self.layoutWidget_2) self.ledit_confirm_branch.setStyleSheet( _fromUtf8("background-color: rgb(255, 255, 255);")) self.ledit_confirm_branch.setObjectName( _fromUtf8("ledit_confirm_branch")) self.verticalLayout_6.addWidget(self.ledit_confirm_branch) self.ledit_master_branch = QtGui.QLineEdit(self.layoutWidget_2) self.ledit_master_branch.setStyleSheet( _fromUtf8("background-color: rgb(255, 255, 255);")) self.ledit_master_branch.setObjectName( _fromUtf8("ledit_master_branch")) self.verticalLayout_6.addWidget(self.ledit_master_branch) self.ledit_project_name = QtGui.QLineEdit(self.layoutWidget_2) self.ledit_project_name.setStyleSheet( _fromUtf8("background-color: rgb(255, 255, 255);")) self.ledit_project_name.setObjectName(_fromUtf8("ledit_project_name")) self.verticalLayout_6.addWidget(self.ledit_project_name) self.horizontalLayout_4.addLayout(self.verticalLayout_6) self.horizontalLayout_3.addLayout(self.horizontalLayout_4) self.btn_config_save_gitlab = QtGui.QPushButton(self.tab_gitlab) self.btn_config_save_gitlab.setGeometry(QtCore.QRect( 550, 280, 101, 41)) self.btn_config_save_gitlab.setStyleSheet( _fromUtf8("background-color: rgb(159, 173, 176);")) self.btn_config_save_gitlab.setObjectName( _fromUtf8("btn_config_save_gitlab")) self.progressBar_gitlab = QtGui.QProgressBar(self.tab_gitlab) self.progressBar_gitlab.setGeometry(QtCore.QRect(40, 320, 501, 31)) self.progressBar_gitlab.setVisible(False) font = QtGui.QFont() font.setBold(False) font.setWeight(50) self.progressBar_gitlab.setFont(font) self.progressBar_gitlab.setStyleSheet(_fromUtf8("")) self.progressBar_gitlab.setProperty("value", 0) self.progressBar_gitlab.setObjectName(_fromUtf8("progressBar_gitlab")) self.tabWidget.addTab(self.tab_gitlab, _fromUtf8("")) self.btn_unlock = QtGui.QPushButton(self.centralwidget) self.btn_unlock.setGeometry(QtCore.QRect(630, 40, 101, 41)) self.btn_unlock.setStyleSheet( _fromUtf8("background-color: rgb(159, 173, 176);")) self.btn_unlock.setObjectName(_fromUtf8("btn_unlock")) self.lbl_error_message = QtGui.QLabel(self.centralwidget) self.lbl_error_message.setGeometry(QtCore.QRect(10, 40, 611, 31)) font = QtGui.QFont() font.setFamily(_fromUtf8("Sans Serif")) font.setBold(False) font.setUnderline(True) font.setWeight(50) self.lbl_error_message.setFont(font) self.lbl_error_message.setStyleSheet( _fromUtf8("color: rgb(255, 0, 0);")) self.lbl_error_message.setText(_fromUtf8("")) self.lbl_error_message.setObjectName(_fromUtf8("lbl_error_message")) self.layoutWidget1 = QtGui.QWidget(self.centralwidget) self.layoutWidget1.setGeometry(QtCore.QRect(20, 10, 231, 34)) self.layoutWidget1.setObjectName(_fromUtf8("layoutWidget1")) self.horizontalLayout_2 = QtGui.QHBoxLayout(self.layoutWidget1) self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.label_6 = QtGui.QLabel(self.layoutWidget1) self.label_6.setObjectName(_fromUtf8("label_6")) self.horizontalLayout_2.addWidget(self.label_6) self.cmb_switch_confirm = QtGui.QComboBox(self.layoutWidget) self.cmb_switch_confirm.setStyleSheet( _fromUtf8("background-color: rgb(255, 255, 255);")) self.cmb_switch_confirm.setObjectName(_fromUtf8("cmb_fw_file_name")) self.cmb_switch_confirm.setEnabled(False) self.horizontalLayout_2.addWidget(self.cmb_switch_confirm) FwSettingsWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(FwSettingsWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 740, 22)) self.menubar.setStyleSheet(_fromUtf8("")) self.menubar.setObjectName(_fromUtf8("menubar")) self.menu_edit = QtGui.QMenu(self.menubar) self.menu_edit.setStyleSheet(_fromUtf8("")) self.menu_edit.setObjectName(_fromUtf8("menu_edit")) self.menu_help = QtGui.QMenu(self.menubar) self.menu_help.setObjectName(_fromUtf8("menu_help")) FwSettingsWindow.setMenuBar(self.menubar) self.action_exit = QtGui.QAction(FwSettingsWindow) self.action_exit.setObjectName(_fromUtf8("action_exit")) self.menu_definitions = QtGui.QAction(FwSettingsWindow) self.menu_definitions.setObjectName(_fromUtf8("menu_definitions")) self.menu_about = QtGui.QAction(FwSettingsWindow) self.menu_about.setObjectName(_fromUtf8("menu_about")) self.menu_edit.addAction(self.action_exit) self.menu_help.addAction(self.menu_definitions) self.menu_help.addAction(self.menu_about) self.menubar.addAction(self.menu_edit.menuAction()) self.menubar.addAction(self.menu_help.menuAction()) self.retranslateUi(FwSettingsWindow) self.tabWidget.setCurrentIndex(0) self.def_window = None self.about_window = None #QtCore.QObject.connect(FwSettingsWindow, QtCore.SIGNAL(_fromUtf8("destroyed()")), self.close_event) QtCore.QObject.connect(self.action_exit, QtCore.SIGNAL(_fromUtf8("triggered()")), FwSettingsWindow.close) #FwSettingsWindow.destroyed.connect(self.close_event) QtCore.QMetaObject.connectSlotsByName(FwSettingsWindow) abs_path = os.path.abspath(__file__) path_list = abs_path.split("/") del path_list[-1] path_name = "/".join(path_list) full_path = path_name + "/" #stylesheets FwSettingsWindow.setStyleSheet( _fromUtf8("QMainWindow#FwSettingsWindow {border-image: url(" + full_path + "img/ahtapot_logo.png);}")) self.git = False self.parent = False self.active_user = "******" self.current_user = "******" confirm_list = [u"Açık", u"Kapalı"] self.cmb_switch_confirm.addItems(confirm_list) with open(full_path + "current_user.dmr", "r") as current_user: self.active_user = current_user.readline() self.logger = Syslogger("FWBUILDER-AHTAPOT", '%(name)s %(levelname)s %(message)s', "/dev/log", self.current_user) self.filelogger = Filelogger( "FWBUILDER-AHTAPOT", '%(asctime)s %(name)s %(levelname)s %(message)s', "/var/log/ahtapot/gdys-gui.log", "a", self.current_user) QtCore.QObject.connect(self.btn_unlock, QtCore.SIGNAL(_fromUtf8("clicked()")), self.unlock_settings) QtCore.QObject.connect( self.cmb_switch_confirm, QtCore.SIGNAL(_fromUtf8("currentIndexChanged(const QString&)")), self.change_confirmation) QtCore.QObject.connect(self.btn_config_save, QtCore.SIGNAL(_fromUtf8("clicked()")), self.save_config_path) QtCore.QObject.connect(self.btn_config_save_gitlab, QtCore.SIGNAL(_fromUtf8("clicked()")), self.save_config_gitlab) QtCore.QObject.connect(self.menu_definitions, QtCore.SIGNAL(_fromUtf8("triggered()")), self.show_def_window) QtCore.QObject.connect(self.menu_about, QtCore.SIGNAL(_fromUtf8("triggered()")), self.show_about_window) self.set_config_text() self.get_confirmation_status() self.get_file_list()