Пример #1
0
 def appui_ok6(self):
     nompro = self.champ0.text()
     refpro = self.champ1.text()
     descpro = self.champ2.text()
     if self.affect_statut.currentText() == 'Commercialisé':
         statpro = 0
     else:
         statpro = 1
     site1 = self.affect_site.currentText()
     refs_existantes = self.data.lister_references()
     if refpro in refs_existantes:
         self.pop1 = Popup()
         self.pop1.ref_exist_err()
     else:
         if (bool(nompro) & bool(refpro)
             ):  ## faire un if imbriqué pour ref existe déjà ou pas
             try:
                 self.data.ajout_produit(nompro, refpro, descpro, statpro,
                                         site1)
                 self.champ0.setText("")
                 self.champ1.setText("")
                 self.champ2.setText("")
                 self.label.setText("Nouveau produit entré en base.")
             except OperationalError:
                 self.label.setText(
                     "Une erreur est survenue. Vérifiez votre connexion avec le serveur de données."
                 )
         else:
             self.pop = Popup()
             self.pop.champ_vide_err("'Nom' et 'Référence'")
Пример #2
0
 def show_popup(self):
     '''Show the text notification popup.'''
     text = self.msgtext.GetValue()
     if text:
         # Text is set, show dialog.  Status of text notification.
         self.textnotif = 'show'
         font = self.data.system['msg_font']
         colors = self.data.system['popup_colors']
         icon = os.path.join(self.mfcdir,
                            self.data.system['icon_close'])
         popup = Popup(parent=self,
                   style=self.bdist,
                   text=text,
                   font=font,
                   colors=colors,
                   icon=icon)
         popw, poph = popup.size
         dispw, disph = wx.GetDisplaySize()
         offx = (dispw - popw) / 2
         offy = (disph - poph) / 2
         popup.Position(ptOrigin=(0, 0), size=(offx, offy))
         popup.Popup()
     else:
         # No text, no Popup, set __textnotif 'close'.
         self.textnotif = 'close'
Пример #3
0
    def confirm(self):
        title = self.get_title()
        content = self.get_content()
        date = '0000-00-00'
        time = '00-00'
        memo_type = 0

        #서버 용량검사, 메모 글자수 검사
        flag = self.title_null_check(title)

        if flag:
            flag = self.text_count(content)
            if flag:
                user_name = User_Notice.get_id()
                memo_db.write_memo(user_name, memo_type, title, content, date,
                                   time)
                #아이디 해야함 ㅇㅇ 연동 ㅇㅇ
                #memo_widget.memo_count += 1
                self.popup = Popup(self)
                self.popup.memo_create_complete()
                self.popup.show()
                self.popup.new_signal.connect(self.complete)
            else:
                self.popup = Popup(self)
                self.popup.memo_create_fail_countover()
                self.popup.show()
        else:
            self.popup = Popup(self)
            self.popup.memo_title_null()
            self.popup.show()
Пример #4
0
    def id_check(self, id):
        flag = False

        if self.id_valid(id):  #id 영문자 숫자 검사
            if db.member_id_check(id):  # id 중복 검사
                flag = True
            else:
                self.popup = Popup(self)
                self.popup.id_duplication_check()
                self.popup.show()
        else:
            self.popup = Popup(self)
            self.popup.id_valid_check()
            self.popup.show()
        return flag
Пример #5
0
    def __init__(self):
        QDialog.__init__(self)
        self.setWindowTitle("IkeoOoooooo")
        self.setGeometry(500, 150, 300, 250)
        self.setStyleSheet("background-color: #003399; color: #FFFFFF")
        try:
            self.data = Bdd()
        except mysql.connector.errors.InterfaceError:
            self.pop = Popup()
            self.pop.connex_err()

        self.label = QLabel()
        self.label2 = QLabel()
        self.label3 = QLabel()
        self.label.setText("Voici la liste de nos sites de production :")
        self.label2.setText(self.affichage5())
        self.label.setAlignment(Qt.AlignCenter)
        self.label2.setAlignment(Qt.AlignCenter)
        self.label2.setStyleSheet(
            "border: 4px solid #FFCC00; font: 10pt Tahoma; color: #FFCC00")
        layout = QVBoxLayout()
        layout.addWidget(self.label)
        layout.addWidget(self.label2)
        layout.addWidget(self.label3)
        self.setLayout(layout)
    def switch_server(self, button):
        text = self.main_window.selected_label.get_text()
        if (text == "Nothing"): return False

        self.main_window.connected_to_label.set_label("Connecting...")
        self.main_window.switch_server_btn.set_sensitive(False)
        openvpn_config_file = self.config_files[text] + "_" + self.config[
            'connection_protocol'] + ".ovpn"

        if (self.vpn_command):
            self.vpn_command.terminate()
            self.thread.join()
            self.main_window.ip_label.set_label("")

        with open(self.folder_path + '.tmp_creds_file', 'a+') as cred_file:
            if (self.config['password_needed']):
                cred_file.write(
                    self.sym_decrypt(self.config['vpn_username']) + "\n" +
                    self.sym_decrypt(self.config['vpn_password']))
            else:
                cred_file.write(self.config['vpn_username'] + "\n" +
                                self.config['vpn_password'])
        subprocess.call([
            "cp", self.folder_path + "vpn_config_files/" + openvpn_config_file,
            self.folder_path + ".tmp_cfg_file"
        ])

        try:
            i = 0
            with open(self.folder_path + '.tmp_cfg_file', 'r+') as cfg_file:
                file = cfg_file.readlines()
                for line in file:
                    if ("auth-user-pass" in line): break
                    i += 1
        except:
            self.debug("VPN config file is missing", "ERROR")
            self.main_window.connected_to_label.set_label("ERROR")
            self.main_window.switch_server_btn.set_sensitive(True)

            Popup(
                'Error',
                "Couldn't find config file for this server, try to update the config files.",
                self.main_window)

            return False

        with open(self.folder_path + '.tmp_cfg_file', 'w') as cfg_file:
            file[i] = "auth-user-pass " + self.folder_path + ".tmp_creds_file"
            cfg_file.writelines(file)

        #disable the killswitch to connect to a new server
        if (self.config["killswitch"] == "on"):
            self.disable_killswitch()

        self.vpn_command = subprocess.Popen(
            ["openvpn", self.folder_path + ".tmp_cfg_file"],
            stdout=subprocess.PIPE)

        self.thread = threading.Thread(target=self.command_log)
        self.thread.start()
Пример #7
0
    def __init__(self, frame, namespace=None):
        """
            Create a Jython Console.
            namespace is an optional and should be a dictionary or Map
        """
        self.frame = frame
        self.history = History(self)

        if namespace != None:
            self.locals = namespace
        else:
            self.locals = {}

        self.buffer = [] # buffer for multi-line commands                    

        self.interp = Interpreter(self, self.locals)
        sys.stdout = StdOutRedirector(self)

        self.text_pane = JTextPane(keyTyped = self.keyTyped, keyPressed = self.keyPressed)
        self.__initKeyMap()

        self.doc = self.text_pane.document
        self.__propertiesChanged()
        self.__inittext()
        self.initialLocation = self.doc.createPosition(self.doc.length-1)

        # Don't pass frame to popups. JWindows with null owners are not focusable
        # this fixes the focus problem on Win32, but make the mouse problem worse
        self.popup = Popup(None, self.text_pane)
        self.tip = Tip(None)

        # get fontmetrics info so we can position the popup
        metrics = self.text_pane.getFontMetrics(self.text_pane.getFont())
        self.dotWidth = metrics.charWidth('.')
        self.textHeight = metrics.getHeight()
    def download_success(self):

        self.cancle_download()

        self.popup = Popup(self)
        self.popup.download_complete()
        self.popup.show()
    def rename_success(self):
        self.display_update()
        self.cancle_rename()

        self.popup = Popup(self)
        self.popup.rename_complete()
        self.popup.show()
    def confirm(self):
        self.location = self.get_location()

        self.popup = Popup(self)
        self.popup.weather_complete()
        self.popup.show()
        self.popup.new_signal.connect(self.complete)
    def upload_success(self):
        self.display_update()
        self.cancle_upload()

        self.popup = Popup(self)
        self.popup.upload_complete()
        self.popup.show()
Пример #12
0
    def show_popup(self, title, text, callback=None, buttons=['OK']):
        popup = Popup(self.app, self.screen, title, text, buttons)
        self.add(popup)

        old_focus = self.focus  # save focus at time of popup call
        self.focus = popup

        def wrapped_callback(btn):
            nonlocal popup  # otherwise assignment to this variable will mark it as local

            log.info('popup wrapped_callback, restoring focus to {}'.format(
                old_focus))
            self.focus = old_focus  # restore focus
            popup.visible = False
            #popup.screen.clear()
            self.widgets.remove(popup)

            self.screen.clear()
            self.screen.refresh()

            del popup
            popup = None

            if callback:
                callback(btn)

            self.screen.clear()

        popup.callback = wrapped_callback
Пример #13
0
    def __init__(self, root, model, controller):
        self.model = model
        self.root = root
        self.controller = controller
        self.popup = Popup(model)

        # Table setup
        self.frame_table = tk.Frame(root)
        self.table = TableCanvas(self.frame_table)
        self.table.show()

        self.frame_table.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)

        # Buttons setup
        self.frame_buttons = tk.Frame(root)
        # Event handlers
        self.btn_open = tk.Button(self.frame_buttons, text="Open", command=self.controller.openFile)
        self.btn_search = tk.Button(self.frame_buttons, text="Search", command=self.controller.findValue)
        self.btn_statistics = tk.Button(self.frame_buttons, text="Statistics", command=self.controller.getMinMax)
        self.btn_plot = tk.Button(self.frame_buttons, text="Show plot", command=self.controller.openPlot)

        # Grid setup
        self.btn_open.grid(row=0, column=0, sticky="ew", padx=5, pady=5)
        self.btn_search.grid(row=1, column=0, sticky="ew", padx=5, pady=5)
        self.btn_statistics.grid(row=2, column=0, sticky="ew", padx=5, pady=5)
        self.btn_plot.grid(row=3, column=0, sticky="ew", padx=5, pady=5)

        self.frame_buttons.pack(side=tk.LEFT, fill=tk.BOTH)

        #Window setup
        self.root.rowconfigure(0, minsize=800, weight=1)
        self.root.columnconfigure(1, minsize=800, weight=1)
        self.root.title("Log viewer")
Пример #14
0
    def __init__(self, items, x, y, alwaysHighlight = False, delegate = None, *args, **kwargs):
        # activestyle = tk.None suppresses the box in OS X and underline elsewhere.
        defaults = {'activestyle':      tk.NONE,
                    'borderwidth':      0,
                    'exportselection':  False,
                    # Approximate the colors used in OS X:
                    'selectbackground': '#0950CF',
                    'selectforeground': '#FFF',
                    # Normally tk has a weird fake-3D effect - remove that.
                    'relief':           tk.FLAT}
        self._popup   = Popup(x = x, y = y)
        self._listbox = tk.Listbox(self._popup, *args, **dict(defaults, **kwargs))
        self._listbox.pack()

        self.alwaysHighlight = alwaysHighlight
        self._priorSelection = None
        self.delegate = delegate
        self.items = items

        self._listbox.bind('<<ListboxSelect>>', self._selectionChanged)
        self._listbox.bind('<Return>',          self.selectHighlighted)
        self._listbox.bind('<Button-1>',        self.selectHighlighted)
        self._listbox.bind('<Enter>',           self._snapHighlightToMouse)
        self._listbox.bind('<Motion>',          self._snapHighlightToMouse)
        if not self.alwaysHighlight:
            self._listbox.bind('<Leave>', self.unhighlight)
Пример #15
0
 def set_name(self):
     name = str(self.txt_name.text())
     if name != "":
         return name
     else:
         Popup("Inserire nome!", ALERT).exec_()
         return False
    def update(self, switch_state: Callable) -> None:
        if self.gameplay.game_over and not self.end_screen:
            self.end_screen = True
            self.popups.append(Popup("Game over!", color="red"))

        if self.gameplay.game_over and self.gameplay.cancel:
            self.finished = True
            return

        if self.gameplay.cancel:
            if self.gameplay.countdown > 0:
                self.finished = True
                return
            else:
                self.gameplay.game_over = True
                self.gameplay.cancel = False

        self.gameplay.update()

        if self.gameplay.score.lines > 0:
            self.goal -= self.gameplay.score.lines
            self.goal = max(0, self.goal)
            self.gameplay.score.lines = 0

            if self.goal == 0:
                if self.gameplay.level == 15 and not self.end_screen:
                    self.end_screen = True
                    self.gameplay.game_over = True
                    self.popups.append(
                        Popup("You won!", color="green", gcolor="yellow")
                    )
                else:
                    self.gameplay.level += 1
                    self.goal = 5 * self.gameplay.level
                    self.gameplay.fall_interval = self.gravity[
                        self.gameplay.level - 1
                    ]

        self.popups.extend(self.gameplay.get_popups())
        self.gameplay.clear_popups()

        if not self.current_popup and self.popups:
            self.current_popup = self.popups.pop(0)
            self.current_popup.duration *= 2
        elif self.current_popup:
            if not self.current_popup.update():
                self.current_popup = None
Пример #17
0
    def confirm(self):
        input_code = self.certification_input.text()
        generate_code = self.get_certify_code()

        #print("인풋:",input_code)
        #print("인증:", generate_code)
        if input_code == generate_code:  #id와 email에 둘다 일치하는 정보가 있는지 디비 확인
            #True
            self.popup = Popup(self)
            self.popup.pwd_certify_success()
            self.popup.show()
            self.popup.new_signal.connect(self.popup_confirm)

        else:
            self.popup = Popup(self)
            self.popup.pwd_certify_fail()
            self.popup.show()
Пример #18
0
 def __init__(self):
     self.root = tk.Tk()
     self.model = Model()
     self.view = View(self.root, self.model, self)
     self.popup = Popup(self.model)
     self.plot = Plot(self.model)
     self.config = configparser.ConfigParser()
     self.config.read("config.ini")
    def _create_popup(self):
        self._popup = Popup(self._window, self.on_result, self._search_func)
        self._popup.set_default_size(*self._plugin.get_popup_size())
        self._popup.set_transient_for(self._window)
        self._popup.set_position(gtk.WIN_POS_CENTER_ON_PARENT)

        self._window.get_group().add_window(self._popup)
        self._popup.connect('destroy', self.on_popup_destroy)
    def delete_success(self):
        self.remove_file()

        self.cancle_delete()

        self.popup = Popup(self)
        self.popup.delete_complete()
        self.popup.show()
Пример #21
0
 def addToBoard(self):
     global POPUP_COUNTER, POPUP
     """
     funtion to add stuff around the main board space
     it will ultimately be used for things like score
     and varioius similar metrics
     """
     meme_font = pygame.font.SysFont('Comic Sans MS', 25)
     # write some memes on the sides #
     # left_meme = meme_font.render('It ya boi', False, BLACK)
     right_meme = meme_font.render('To play click', False, BLACK)
     right_meme_pt2 = meme_font.render('where you want', False, BLACK)
     right_meme_pt3 = meme_font.render('the bubble to go', False, BLACK)
     # gameDisplay.blit(left_meme, (int(DISPLAY_X * 0.05), int(DISPLAY_Y * 0.1)))
     self.gameDisplay.blit(right_meme, (int(DISPLAY_X * 0.76), int(DISPLAY_Y * 0.02)))
     self.gameDisplay.blit(right_meme_pt2, (int(DISPLAY_X * 0.76), int(DISPLAY_Y * 0.04)))
     self.gameDisplay.blit(right_meme_pt3, (int(DISPLAY_X * 0.76), int(DISPLAY_Y * 0.06)))
     if self.won:
         # create the success popup
         success_poppup = Popup('You Won! Good Job!', int(DISPLAY_X * 0.35), int(DISPLAY_Y * 0.5), self.gameDisplay, BLUE)
         self.current_popups.append(success_poppup)
         success_poppup.create()
         # store the popup for deletion later
         # POPUP = ['Words Matched! Good Job!', int(DISPLAY_X * 0.35), int(DISPLAY_Y * 0.5)]
         # create second success popu TODO: this is a meme, remove it
         success_poppup2 = Popup('Winner, winner, chicken dinner', int(DISPLAY_X * 0.35), int(DISPLAY_Y * 0.4), self.gameDisplay, BLUE)
         self.current_popups.append(success_poppup2)
         success_poppup.create()
     elif self.success_popped:
         # create the success popup
         popped_bubble = Popup('Words Matched! Good Job!', int(DISPLAY_X * 0.35), int(DISPLAY_Y * 0.5), self.gameDisplay, BLUE)
         self.current_popups.append(popped_bubble)
         popped_bubble.create()
         # start the counter
         POPUP_COUNTER += 1
         # store the popup for deletion later
         #POPUP = ['Words Matched! Good Job!', int(DISPLAY_X * 0.35), int(DISPLAY_Y * 0.5)]
         self.success_popped = False
     elif self.game_over:
         # create the game over popup
         lost_popup = Popup('Game over man, game over!', int(DISPLAY_X * 0.35), int(DISPLAY_Y * 0.4), self.gameDisplay, RED)
         self.current_popups.append(lost_popup)
         lost_popup.create()
         # start the counter
         POPUP_COUNTER += 1
    def upload_success(self):
        self.display_update()
        self.cancle_upload()

        self.popup = Popup(self)
        self.popup.upload_complete()
        self.popup.show()

        self.file_to_main_signal.emit()
Пример #23
0
    def _create_popup(self):
        paths = []

        # Open documents
        paths.append(CurrentDocumentsDirectory(self._window))

        doc = self._window.get_active_document()

        # Current document directory
        if doc and doc.is_local():
            gfile = doc.get_location()
            paths.append(gfile.get_parent())

        # File browser root directory
        bus = self._window.get_message_bus()

        try:
            msg = bus.send_sync('/plugins/filebrowser', 'get_root')

            if msg:
                uri = msg.get_value('uri')

                if uri:
                    gfile = gio.File(uri)

                    if gfile.is_native():
                        paths.append(gfile)

        except StandardError:
            pass

        # Recent documents
        paths.append(
            RecentDocumentsDirectory(screen=self._window.get_screen()))

        # Local bookmarks
        for path in self._local_bookmarks():
            paths.append(path)

        # Desktop directory
        desktopdir = self._desktop_dir()

        if desktopdir:
            paths.append(gio.File(desktopdir))

        # Home directory
        paths.append(gio.File(os.path.expanduser('~')))

        self._popup = Popup(self._window, paths, self.on_activated)

        self._popup.set_default_size(*self._plugin.get_popup_size())
        self._popup.set_transient_for(self._window)
        self._popup.set_position(gtk.WIN_POS_CENTER_ON_PARENT)

        self._window.get_group().add_window(self._popup)

        self._popup.connect('destroy', self.on_popup_destroy)
Пример #24
0
    def addHabit(self):
        popup = Popup(self.window)
        popup.promptUser(True)
        self.window.wait_window(popup.window)

        if popup.isValid:
            name = popup.input.get()
            habit = Habit(name, 0, False, self.fr_list)
            self.habits.append(habit)
            habit.display()
Пример #25
0
 def __init__(self):
     QDialog.__init__(self)
     self.setWindowTitle("IkeoOoooooo")
     self.setGeometry(500, 50, 500, 450)
     self.setStyleSheet("background-color: #003399; color: #FFFFFF")
     try:
         self.data = Bdd()
     except mysql.connector.errors.InterfaceError:
         self.pop = Popup()
         self.pop.connex_err()
Пример #26
0
    def _create_popup(self):
        self._popup = Popup(self._window, self.on_selected)

        self._popup.set_default_size(*self._plugin.get_popup_size())
        self._popup.set_transient_for(self._window)
        self._popup.set_position(gtk.WIN_POS_CENTER_ON_PARENT)

        self._window.get_group().add_window(self._popup)

        self._popup.connect("destroy", self._destroy_popup)
Пример #27
0
    def pwd_check(self, pwd1, pwd2):
        flag = False

        if pwd1 == pwd2:
            flag = True
        else:
            self.popup = Popup(self)
            self.popup.pwd_coincidence_check()
            self.popup.show()
        return flag
Пример #28
0
def update(time_sleep=0, msg=""):
    screen.fill((255, 228, 181))
    for i in rect:
        pygame.draw.rect(screen, (255, 255, 255), i.rect)
        i.draw()
    if msg:
        Popup(screen, msg)
    pygame.display.flip()
    if time_sleep:
        time.sleep(time_sleep)
    def rename_success(self):

        self.display_update()
        self.cancle_rename()

        self.popup = Popup(self)
        self.popup.rename_complete()
        self.popup.show()

        self.file_to_main_signal.emit()  #
Пример #30
0
 def show_popup(self):
     '''Show the text notification popup.'''
     text = self.__msgtext.GetValue()
     if text:
         # Text is set, show dialog.
         font = self.__data.get_sys('msg_font')
         colors = self.__data.get_sys('popup_colors')
         icon = os.path.join(self.__dir, self.__data.get_sys('icon_close'))
         popup = Popup(parent=self,
                       style=self.__bdist,
                       text=text,
                       font=font,
                       colors=colors,
                       icon=icon)
         popw, poph = popup.get_size()
         dispw, disph = wx.GetDisplaySize()
         offx = (dispw - popw) / 2
         offy = (disph - poph) / 2
         popup.Position(ptOrigin=(0, 0), size=(offx, offy))
         popup.Popup()