Beispiel #1
0
 def OnSubMenuSub_about_menuMenu(self, event):
     dlg = About(self)
     try:
         if dlg.ShowModal() == wx.ID_OK:
             pass
     finally:
         dlg.Destroy()
 def OnAbout(self, event):
     '''
     :显示软件的功能等信息
     :param event:事件值
     '''
     dlg = About(self)
     dlg.ShowModal()  #显示“关于”窗口
     dlg.Destroy()
Beispiel #3
0
def display_page(pathname):
    if pathname == "/player-stats":
        return App()
    elif pathname == "/about":
        return About()
    else:
        return Homepage()
    def __init__(self):
        super(Main, self).__init__()
        self.tabw = QTabWidget(self)

        self.cw1 = MoveRename()
        self.tabw.addTab(self.cw1, 'Mover/Renombrar')

        self.cw2 = Falta()
        self.tabw.addTab(self.cw2, 'Falta')

        # self.cw3 = FTPGui()
        # self.tabw.addTab(self.cw3,'FTP')

        self.cw4 = FileGui()
        self.tabw.addTab(self.cw4, 'Sync')

        self.cw5 = About()
        self.tabw.addTab(self.cw5, 'About')

        self.tabw.setTabShape(QTabWidget.Triangular)
        self.tabw.setTabPosition(QTabWidget.West)
        self.setCentralWidget(self.tabw)
        self.logs = QTextEdit()
        self.logs.setReadOnly(True)
        self.logsdock = QDockWidget("Logs", self)
        self.logsdock.setAllowedAreas(
            Qt.BottomDockWidgetArea | Qt.TopDockWidgetArea)
        self.logsdock.setWidget(self.logs)
        self.logsdock.setFeatures(QDockWidget.DockWidgetMovable)
        self.addDockWidget(Qt.BottomDockWidgetArea, self.logsdock)
        self.cw1.logginn.connect(self.loggin)
        self.cw2.logginn.connect(self.loggin)
        # self.cw3.logginn.connect(self.loggin)
        self.cw4.logginn.connect(self.loggin)
Beispiel #5
0
    def __init__(self, address):

        super().__init__(address)

        self.about = About(self)
        self.access = Access(self)
        self.adjustment = Adjustment(self)
        self.axis = Axis(self)
        self.displacement = Displacement(self)
        self.ecu = Ecu(self)
        self.functions = Functions(self)
        self.manual = Manual(self)
        self.network = Network(self)
        self.nlc = Nlc(self)
        self.pilotlaser = Pilotlaser(self)
        self.realtime = Realtime(self)
        self.system = System(self)
        self.system_service = System_service(self)
        self.update = Update(self)
        try:
            self.streaming = Streaming(self)
        except NameError as e:
            if "Streaming" in str(e):
                print("Warning: Streaming is not supported on your platform")
            else:
                raise e
Beispiel #6
0
    def setupUi(self, MainWindow):
        super(UiOverlayWindow, self).setupUi(MainWindow)

        # Add the custom GPS widget
        layout = QtGui.QVBoxLayout()
        self.widgetGPSBarPlot.setLayout(layout)
        self.gpsBarPlot = GPSBarPlot(self.widgetGPSBarPlot)
        layout.addWidget(self.gpsBarPlot)
        # self.gpsBarPlot.setGeometry(QtCore.QRect(10, 10, 500, 200))

        # Add the custom GPS satellites widget
        layout = QtGui.QVBoxLayout()
        self.widgetGPSSatellitePlot.setLayout(layout)
        self.gpsSatellitePlot = GPSSatellitePlot(self.widgetGPSSatellitePlot)
        layout.addWidget(self.gpsSatellitePlot)

        # Add the connection status label to statusbar
        self.label_connection_status = QtGui.QLabel()
        self.label_connection_status_led = QtGui.QLabel()
        self.statusbar.addPermanentWidget(self.label_connection_status)
        self.statusbar.addPermanentWidget(self.label_connection_status_led)
        self.setStatusDisconnected()

        # About Dialog
        self.aboutWindow = About(self)
        self.actionAbout.triggered.connect(self.aboutWindow.show)
Beispiel #7
0
    def AboutQdvgrab(self):

        """
        Run the About Dialog

        """

        self.windo = About()
        self.windo.show()
Beispiel #8
0
    def run_preferences_screen(self):

        """
        Run the Preferences Dialog

        """

        self.windo = PreFerences()
        self.windo.show()
    def about(self):
        """
            Description: Invoked when the user clicks on the 'About' button in the toolbar.
            Arguments: None
            Returns: Nothing
        """

        self.lastclick = int(time())  # Last click timestamp update
        About()
Beispiel #10
0
    def __init__(self):
        QWidget.__init__(self)
        self._ui_model = None
        self._about = About()

        self.setWindowTitle('About Kunquat Tracker')

        v = QVBoxLayout()
        v.addWidget(self._about)
        self.setLayout(v)
 def OnMenuAbout(self, event): # wxGlade: MainFrame.<event_handler>
     about = About()
     about.read(pathToResources + "/about.txt")
     info = wx.AboutDialogInfo()
     info.SetName(about.getName())
     info.SetVersion(about.getVersion())
     info.SetDescription(about.getDescription())
     info.SetCopyright(about.getAuthor())
     wx.AboutBox(info)
Beispiel #12
0
 def testReadWrite(self):
     """ AboutTests: testReadWrite. """
     filename = "about_test.txt"
     # write the default about
     about = About()
     about.write(filename)
     # read it back
     about2 = About()
     about2.read(filename)
     # compare the 2 objects
     assert about == about2
     # clean up
     os.remove(filename)
Beispiel #13
0
 def getter(self):
     ans = About.by_id(self.data['about_id'])
     if ans is None:
         ans = About()
         self.data['about_id'] = ans._id
         ans.set_propertys(author_id=self.data['owner_id'], env=self)
         return ans, True
     if not ans.author_id or not ans.env_id or not ans.env_type:
         ans.set_propertys(author_id=self.data['owner_id'], env=self)
     return ans
Beispiel #14
0
def display_page(pathname):
    if pathname == '/about':
        return About()
    if pathname == '/blog':
        return Blog()
    if pathname == '/portfolio':
        return Portfolio()
    if pathname == '/auditor':
        return Auditor()
    if pathname == '/home':
        return Homepage()
    else:
        return Homepage()
Beispiel #15
0
class AboutWindow(QWidget):

    def __init__(self):
        QWidget.__init__(self)
        self._ui_model = None
        self._about = About()

        self.setWindowTitle('About Kunquat Tracker')

        v = QVBoxLayout()
        v.addWidget(self._about)
        self.setLayout(v)

    def set_ui_model(self, ui_model):
        self._ui_model = ui_model
        self._about.set_ui_model(ui_model)

    def unregister_updaters(self):
        self._about.unregister_updaters()

    def closeEvent(self, ev):
        ev.ignore()
        visibility_manager = self._ui_model.get_visibility_manager()
        visibility_manager.hide_about()
Beispiel #16
0
 def getter(self):
     ans = About.by_id(self.data['about_id'])
     if ans is None:
         ans = About()
         self.data['about_id'] = ans._id
         ans.set_propertys(author_id=self.data['owner_id'], env=self)
         return ans, True
     if not ans.author_id or not ans.env_id or not ans.env_type:
         ans.set_propertys(author_id=self.data['owner_id'], env=self)
     return ans
Beispiel #17
0
 def testReadWrite(self):
     """ AboutTests: testReadWrite. """
     filename = "about_test.txt"
     # write the default about
     about = About()
     about.write(filename)
     # read it back
     about2 = About()
     about2.read(filename)
     # compare the 2 objects
     assert about == about2
     # clean up
     os.remove(filename)
Beispiel #18
0
    def __init__(self, address):

        super().__init__(address)

        self.about = About(self)
        self.access = Access(self)
        self.amcids = Amcids(self)
        self.control = Control(self)
        self.description = Description(self)
        self.diagnostic = Diagnostic(self)
        self.functions = Functions(self)
        self.move = Move(self)
        self.network = Network(self)
        self.res = Res(self)
        self.rotcomp = Rotcomp(self)
        self.rtin = Rtin(self)
        self.rtout = Rtout(self)
        self.status = Status(self)
        self.system_service = System_service(self)
        self.update = Update(self)
Beispiel #19
0
    def build(self, *a):
        self.new_game = Gtk.ToolButton()
        self.new_game.set_label(_('New game'))
        self.new_game.connect('clicked', self.restart_game)
        self.pack_start(self.new_game, False, False, 0)
        self.pack_start(Gtk.Separator(), False, False, 3)

        btn_lang = Gtk.ToolButton()
        btn_lang.set_label(_('Preference'))
        self.pack_start(btn_lang, False, False, 0)
        btn_lang.connect('clicked', lambda *a: DialogPreference(self.pt))
        btn_lang.connect('clicked',
                         lambda *a: self.pt.hd_bar.btn_pref.set_active(False))

        btn_about = Gtk.ToolButton()
        btn_about.set_label(_('About!'))
        self.pack_start(btn_about, False, False, 0)
        btn_about.connect('clicked',
                          lambda *a: self.pt.hd_bar.btn_pref.set_active(False))
        btn_about.connect('clicked', lambda *a: About(self.pt))
        self.show_all()
Beispiel #20
0
 def __init__(self):
     pathToResources = "../resources"
     pathToSrc = "../src"
     # Resources of the setup script
     self.resources = []
     # Resource files to add to bin folder.
     self.__addToResources(pathToResources)
     # Doc files to add to bin folder.
     self.__addToResources("../doc/html")
     # script file
     self.script = pathToSrc + "/StartNewModule.py"
     self.icon_resource = pathToResources + "/startnewmodule.ico"
     # options
     about = About()
     about.read( pathToResources + "/about.txt")
     self.name = about.getName()
     self.version = about.getVersion()
     self.description = about.getDescription()
     self.author = about.getAuthor()
Beispiel #21
0
    def __init__(self, master):
        self.master = master
        master.configure(bg='gray15')
        master.title('Component Cost Calculator')
        master.option_add('*Font', 'System 12')
        master.option_add('*Label.Font', 'System 14')
        master.geometry('1920x1080')

        master.protocol("WM_DELETE_WINDOW", self.on_close)

        # Window Icon
        # master.iconbitmap('ocrbigger.ico')

        global_frame = tk.Frame(master, relief=tk.FLAT, bd=1, bg='gray15')
        global_frame.pack(fill=tk.BOTH, side=tk.TOP)

        global_label = tk.Label(global_frame, relief=tk.GROOVE, bd=1)
        global_label.config(text='Component Cost Calculator v5.0',
                            font='System 12')
        global_label.pack(fill=tk.X, anchor=tk.N)

        # Have a global 'Exit Current Configuration' Button.
        # Sort of like a logout button, if you will.
        exit_current_config_button = ttk.Button(
            global_frame,
            text='Exit Configuration',
            command=self.exit_current_config)
        exit_current_config_button.pack(side=tk.RIGHT)

        main_notebook = ttk.Notebook(master)
        main_notebook.pack(fill=tk.BOTH, expand=True)

        Home(master, main_notebook)
        Turbines(master, main_notebook)
        HeatExchangers(master, main_notebook)
        Pumps(master, main_notebook)
        Expanders(master, main_notebook)
        StorageTanks(master, main_notebook)
        Results(master, main_notebook)
        About(master, main_notebook)
Beispiel #22
0
 def __init__(self):
     pathToResources = "../resources/"
     pathToSrc = "../src/"
     # Resources of the setup script
     self.resources = []
     # Files at root level
     self.__addToResources("../readme.md", ".")
     self.__addToResources("../license.txt", ".")
     # Resource files to add to bin folder.
     self.__addToResources(pathToResources, "resources")
     # Doc files to add to bin folder.
     self.__addToResources("../doc/html/", "doc/html")
     self.__addToResources("../doc/html/search/", "doc/html/search")
     # script
     self.script = pathToSrc + "csnGUI.py"
     self.icon_resource = pathToResources + "Laticauda_colubrina.ico"
     # options
     about = About()
     about.read( pathToResources + "about.txt")
     self.name = about.getName()
     self.version = about.getVersion()
     self.description = about.getDescription()
     self.author = about.getAuthor()
Beispiel #23
0
 def __init__(self):
     pathToResources = "../resources/"
     pathToSrc = "../src/"
     # Resources of the setup script
     self.resources = []
     # Files at root level
     self.__addToResources("../readme.txt", ".")
     self.__addToResources("../license.txt", ".")
     # Resource files to add to bin folder.
     self.__addToResources(pathToResources, "resources")
     # Doc files to add to bin folder.
     self.__addToResources("../doc/html/", "doc/html")
     self.__addToResources("../doc/html/search/", "doc/html/search")
     # script
     self.script = pathToSrc + "csnGUI.py"
     self.icon_resource = pathToResources + "Laticauda_colubrina.ico"
     # options
     about = About()
     about.read( pathToResources + "about.txt")
     self.name = about.getName()
     self.version = about.getVersion()
     self.description = about.getDescription()
     self.author = about.getAuthor()
Beispiel #24
0
class ElmoCut(QMainWindow, Ui_MainWindow):
    def __init__(self):
        super().__init__()
        self.version = 1.1
        self.icon = self.processIcon(app_icon)

        # Add window icon
        self.setWindowIcon(self.icon)
        self.setupUi(self)
        self.setStyleSheet(load_stylesheet())

        # Main Props
        self.scanner = Scanner()
        self.killer = Killer()

        # Settings props
        self.minimize = True
        self.remember = False

        self.from_tray = False

        # We send elmocut to the settings window
        self.settings_window = Settings(self, self.icon)
        self.about_window = About(self, self.icon)

        self.applySettings()

        # Threading
        self.scan_thread = ScanThread()
        self.scan_thread.thread_finished.connect(self.ScanThread_Reciever)
        self.scan_thread.progress.connect(self.pgbar.setValue)

        # Connect buttons
        self.buttons = [
            (self.btnScanEasy, self.scanEasy, scan_easy_icon, 'Arping Scan'),
            (self.btnScanHard, self.scanHard, scan_hard_icon, 'Pinging Scan'),
            (self.btnKill, self.kill, kill_icon, 'Kill selected device'),
            (self.btnUnkill, self.unkill, unkill_icon,
             'Un-kill selected device'),
            (self.btnKillAll, self.killAll, killall_icon, 'Kill all devices'),
            (self.btnUnkillAll, self.unkillAll, unkillall_icon,
             'Un-kill all devices'),
            (self.btnSettings, self.openSettings, settings_icon,
             'View elmoCut settings'),
            (self.btnAbout, self.openAbout, about_icon, 'About elmoCut')
        ]

        for btn, btn_func, btn_icon, btn_tip in self.buttons:
            btn.setToolTip(btn_tip)
            btn.clicked.connect(btn_func)
            btn.setIcon(self.processIcon(btn_icon))

        self.pgbar.setVisible(False)

        # Table Widget
        self.tableScan.itemClicked.connect(self.deviceClicked)
        self.tableScan.cellClicked.connect(self.cellClicked)
        self.tableScan.setColumnCount(4)
        self.tableScan.verticalHeader().setVisible(False)
        self.tableScan.setHorizontalHeaderLabels(
            ['IP Address', 'MAC Address', 'Vendor', 'Type'])
        '''
           System tray icon and it's tray menu
        '''
        show_option = QAction('Show', self)
        hide_option = QAction('Hide', self)
        quit_option = QAction('Quit', self)
        kill_option = QAction(self.processIcon(kill_icon), '&Kill All', self)
        unkill_option = QAction(self.processIcon(unkill_icon), '&Unkill All',
                                self)

        show_option.triggered.connect(self.show)
        hide_option.triggered.connect(self.hide_all)
        quit_option.triggered.connect(self.quit_all)
        kill_option.triggered.connect(self.killAll)
        unkill_option.triggered.connect(self.unkillAll)

        tray_menu = QMenu()
        tray_menu.addAction(show_option)
        tray_menu.addAction(hide_option)
        tray_menu.addSeparator()
        tray_menu.addAction(kill_option)
        tray_menu.addAction(unkill_option)
        tray_menu.addSeparator()
        tray_menu.addAction(quit_option)

        self.tray_icon = QSystemTrayIcon(self)
        self.tray_icon.setIcon(self.icon)
        self.tray_icon.setToolTip('elmoCut')
        self.tray_icon.setContextMenu(tray_menu)
        self.tray_icon.show()
        self.tray_icon.activated.connect(self.tray_clicked)

    @staticmethod
    def processIcon(icon_data):
        """
        Create icon pixmap object from raw data
        """
        pix = QPixmap()
        icon = QIcon()
        pix.loadFromData(icon_data)
        icon.addPixmap(pix)
        return icon

    def connected(self):
        """
        Prompt when disconnected
        """
        if is_connected():
            return True
        self.log('Connection lost!', 'red')
        QMessageBox.critical(self, 'elmoCut', 'Connection Lost!')
        return False

    def log(self, text, color='white'):
        """
        Print log info at left label
        """
        self.lblleft.setText(f"<font color='{color}'>{text}</font>")

    def openSettings(self):
        """
        Open settings window
        """
        self.settings_window.hide()
        self.settings_window.currentSettings()
        self.settings_window.show()

    def openAbout(self):
        """
        Open about window
        """
        self.about_window.hide()
        self.about_window.show()

    def applySettings(self):
        """
        Apply saved settings
        """
        self.settings_window.updateElmocutSettings()

    def tray_clicked(self, event):
        """
        Show elmoCut when tray icon is left-clicked
        """
        if event == QSystemTrayIcon.Trigger:
            self.show()

    def hide_all(self):
        """
        Hide option for tray (Hides window and settings)
        """
        self.hide()
        self.settings_window.hide()
        self.about_window.hide()

    def quit_all(self):
        """
        Unkill any killed device on exit from tray icon
        """
        self.killer.unkill_all()
        self.settings_window.close()
        self.about_window.close()
        self.from_tray = True
        self.close()

    def resizeEvent(self, event=True):
        """
        Auto resize table widget columns dynamically
        """
        for i in range(4):
            self.tableScan.setColumnWidth(i, self.tableScan.width() // 4)

    def closeEvent(self, event):
        """
        Run in background if self.minimize is True else exit
        """
        # If event recieved from tray icon
        if self.from_tray:
            event.accept()
            return

        # If event is recieved from close X button

        ## If minimize is true
        if self.minimize:
            event.ignore()
            self.hide_all()
            return

        ## If not kill all and shutdown
        self.killer.unkill_all()
        self.settings_window.close()
        self.about_window.close()

        self.hide()

        QMessageBox.information(
            self, 'Shutdown', 'elmoCut will exit completely.\n\n'
            'Enable minimized from settings\n'
            'to be able to run in background.')

        event.accept()

    def current_index(self):
        return self.scanner.devices[self.tableScan.currentRow()]

    def cellClicked(self, row, column):
        """
        Copy selected cell data to clipboard
        """
        # Get current row
        device = self.current_index()

        # Get cell text using dict.values instead of .itemAt()
        cell = list(device.values())[column]
        self.lblcenter.setText(cell)
        copy(cell)

    def deviceClicked(self):
        """
        Disable kill, unkill buttons when admins are selected
        """
        not_enabled = not self.current_index()['admin']

        self.btnKill.setEnabled(not_enabled)
        self.btnUnkill.setEnabled(not_enabled)

    def showDevices(self):
        """
        View scanlist devices with correct colors processed
        """
        self.tableScan.clearSelection()
        self.tableScan.clearContents()
        self.tableScan.setRowCount(len(self.scanner.devices))

        for row, device in enumerate(self.scanner.devices):
            for column, item in enumerate(device.values()):
                # Skip 'admin' key
                if type(item) == bool:
                    continue

                # Center text in eah cell
                ql = QTableWidgetItem()
                ql.setText(item)
                ql.setTextAlignment(Qt.AlignCenter)

                # Highlight Admins and killed devices
                if device['admin']:
                    colored_item(ql, '#00ff00', '#000000')
                if device['mac'] in self.killer.killed:
                    colored_item(ql, '#ff0000', '#ffffff')

                # Add cell to the row
                self.tableScan.setItem(row, column, ql)

        status = f'{len(self.scanner.devices) - 2} devices' \
                 f' ({len(self.killer.killed)} killed)'

        self.lblright.setText(status)
        self.tray_icon.setToolTip(status)

        # Show selected cell data
        self.lblcenter.setText('Nothing Selected')

    def processDevices(self):
        """
        Rekill any paused device after scan
        """
        self.tableScan.clearSelection()

        # first device in list is the router
        self.killer.router = self.scanner.router

        # re-kill paused and update to current devices
        self.killer.rekill_stored(self.scanner.devices)
        for rem_device in self.scanner.devices:
            if rem_device['mac'] in get_settings('killed') * self.remember:
                self.killer.kill(rem_device)

        # clear old database
        self.killer.release()

        self.log(f'Found {len(self.scanner.devices) - 1} devices.', 'orange')

        self.showDevices()

    @check_connection
    def kill(self):
        """
        Apply ARP spoofing to selected device
        """
        if not self.tableScan.selectedItems():
            self.log('No device selected.', 'red')
            return

        device = self.current_index()

        if device['mac'] in self.killer.killed:
            self.log('Device is already killed.', 'red')
            return

        # Killing process
        self.killer.kill(device)
        set_settings('killed', list(self.killer.killed) * self.remember)
        self.log('Killed ' + device['ip'], 'fuchsia')

        self.showDevices()

    @check_connection
    def unkill(self):
        """
        Disable ARP spoofing on previously spoofed devices
        """
        if not self.tableScan.selectedItems():
            self.log('No device selected.', 'red')
            return

        device = self.current_index()

        if device['mac'] not in self.killer.killed:
            self.log('Device is already unkilled.', 'red')
            return

        # Unkilling process
        self.killer.unkill(device)
        set_settings('killed', list(self.killer.killed) * self.remember)
        self.log('Unkilled ' + device['ip'], 'lime')

        self.showDevices()

    @check_connection
    def killAll(self):
        """
        Kill all scanned devices except admins
        """
        self.killer.kill_all(self.scanner.devices)
        set_settings('killed', list(self.killer.killed) * self.remember)
        self.log('Killed All devices.', 'fuchsia')

        self.showDevices()

    @check_connection
    def unkillAll(self):
        """
        Unkill all killed devices except admins
        """
        self.killer.unkill_all()
        set_settings('killed', list(self.killer.killed) * self.remember)
        self.log('Unkilled All devices.', 'lime')

        self.showDevices()

    def scanEasy(self):
        """
        Easy Scan button connector
        """
        self.ScanThread_Starter()

    def scanHard(self):
        """
        Hard Scan button connector
        """
        # Set correct max for progress bar
        self.ScanThread_Starter(scan_type=1)

    def ScanThread_Starter(self, scan_type=0):
        """
        self.scan_thread QThread Starter
        """
        if not self.connected():
            return

        self.centralwidget.setEnabled(False)

        # Save copy of killed devices
        self.killer.store()

        self.killer.unkill_all()

        self.log(['Arping', 'Pinging'][scan_type] + ' your network...',
                 ['aqua', 'fuchsia'][scan_type])

        self.pgbar.setVisible(True)
        self.pgbar.setMaximum(self.scanner.device_count)
        self.pgbar.setValue(self.scanner.device_count * (not scan_type))

        self.scan_thread.scanner = self.scanner
        self.scan_thread.scan_type = scan_type
        self.scan_thread.start()

    def ScanThread_Reciever(self):
        """
        self.scan_thread QThread results reciever
        """
        self.centralwidget.setEnabled(True)
        self.pgbar.setVisible(False)
        self.processDevices()
Beispiel #25
0
 def click_about(self, widget):
     About()
 coreObject.addThread(mainMenu.mainMenu(menuChoice))
 menuChoice, menuSize = menuChoice.get()
 menuChoice = int(menuChoice)
 if menuChoice == menuSize:  # exit
     exitSignal = False
     clearScreen()
     printOSinfo()
     # About
 if menuChoice == 1:
     clearScreen()
     aboutMenuChoice = queue.Queue()
     coreObject.addThread(mainMenu.aboutMenu(aboutMenuChoice))
     aboutMenuChoice, exitChoice = aboutMenuChoice.get()
     if aboutMenuChoice == exitChoice:
         pass
     osInfo = About()
     aboutMenuChoice = int(aboutMenuChoice)
     if aboutMenuChoice == 2:
         clearScreen()
         contactsInfo = queue.Queue()
         coreObject.addThread(osInfo.getDeveloperContacts(contactsInfo))
         contactsInfo = contactsInfo.get()
         print(contactsInfo)
         input()
     if aboutMenuChoice == 3:
         clearScreen()
         featuresInfo = queue.Queue()
         coreObject.addThread(osInfo.getComingFeatures(featuresInfo))
         featuresInfo = featuresInfo.get()
         print(featuresInfo)
         input()
Beispiel #27
0
    def __init__(self, master=None):
        Thread(target=self.user_check_updates, daemon=True).start()

        # preparing containers
        c1 = Frame(master)
        c1['pady'] = 20
        c1.pack()

        c2 = Frame(master)
        c2.pack()

        c3 = Frame(master)
        c3['pady'] = 20
        c3.pack()

        c4 = Frame(master)
        c4.pack()

        c5 = Frame(master)
        c5.pack()

        c6 = Frame(master)
        c6.pack()

        c7 = Frame(master)
        c7.pack()

        # Menubar
        menubar = Menu(window, tearoff=0, bd=0, bg='#d9d9d9')
        file = Menu(menubar, tearoff=0, bd=0)
        menubar.add_cascade(label=_('File'), menu=file)
        file.add_command(label=_('Load audio file...'), accelerator='Ctrl+O', command=lambda: self.btnLoadAudio())
        file.add_command(label=_('Save all tags'), accelerator='Ctrl+S', command=lambda: self.btnSaveTags())
        file.add_separator()
        file.add_command(label=_('Exit'), accelerator='Ctrl+Q', command=lambda: window.destroy())

        help = Menu(menubar, tearoff=0, bd=0)
        menubar.add_cascade(label=_('Help'), menu=help)
        help.add_command(label='GitHub', accelerator='Ctrl+G', command=lambda: window.bind('<Button-1>', webbrowser.open('https://github.com/Alexsussa/eyed3-gtk-gui')))
        help.add_command(label=_('License'), accelerator='Ctrl+I', command=lambda: window.bind('<Button-1>', webbrowser.open('https://github.com/Alexsussa/eyed3-gtk-gui/blob/master/LICENSE')))
        help.add_command(label=_('Documentation'), accelerator='Ctrl+D', command=lambda: window.bind('<Button-1>', webbrowser.open('https://github.com/Alexsussa/eyed3-gtk-gui#eyed3-gtk-gui')))
        help.add_command(label=_('Search for new updates...'), accelerator='Ctrl+N', command=lambda: self.check_updates())
        help.add_separator()
        help.add_command(label=_('About'), accelerator='Ctrl+H', command=lambda: About.about(self, window=window))

        window.config(menu=menubar)

        # preparing interface
        self.lbtitle = Label(c1, text=_('Title'))
        self.lbtitle.pack(side=LEFT, padx=5)
        self.txttitle = Entry(c1, width=40, bg='white', fg='black')
        self.txttitle.pack(side=LEFT)

        self.lbartist = Label(c1, text=_('Artist'))
        self.lbartist.pack(side=LEFT, padx=5)
        self.txtartist = Entry(c1, width=40, bg='white', fg='black')
        self.txtartist.pack(side=LEFT)

        self.lbtrack_num = Label(c1, text=_('Track Number'))
        self.lbtrack_num.pack(side=LEFT, padx=5)
        self.txttrack_num = Entry(c1, width=4, bg='white', fg='black')
        self.txttrack_num.pack(side=LEFT)

        self.lbalbum = Label(c2, text=_('Album'))
        self.lbalbum.pack(side=LEFT, padx=5)
        self.txtalbum = Entry(c2, width=36, bg='white', fg='black')
        self.txtalbum.pack(side=LEFT)

        self.lbalbum_artist = Label(c2, text=_('Album Artist'))
        self.lbalbum_artist.pack(side=LEFT, padx=5)
        self.txtalbum_artist = Entry(c2, width=36, bg='white', fg='black')
        self.txtalbum_artist.pack(side=LEFT)

        self.btnremove_all_tags = Button(c2, text=_('Remove All Tags'), width=15, command=self.btnRemoveAllTags)
        self.btnremove_all_tags.pack(side=LEFT, padx=5)
        ttips.Create(self.btnremove_all_tags, text=_('Remove completly all tags from audio'))

        self.lbgenre = Label(c3, text=_('Genre'))
        self.lbgenre.pack(side=LEFT, padx=5)
        self.txtgenre = Entry(c3, width=15, bg='white', fg='black')
        self.txtgenre.pack(side=LEFT)

        self.lbyear = Label(c3, text=_('Year'))
        self.lbyear.pack(side=LEFT, padx=5)
        self.txtyear = Entry(c3, width=5, bg='white', fg='black')
        self.txtyear.pack(side=LEFT)

        self.txtlyrics = Entry(c3, width=31, bg='white', fg='black')
        self.txtlyrics.pack(side=LEFT, padx=5)
        self.txtlyrics.drop_target_register(DND_FILES)
        ttips.Create(self.txtlyrics, text=_('Select a txt file with lyrics by clicking the button'))
        self.btnlyrics = Button(c3, text=_('Lyrics'), command=self.btnLoadLyrics)
        self.btnlyrics.pack(side=LEFT)
        ttips.Create(self.btnlyrics, text=_('Select a txt file with lyrics'))

        self.txtcover = Entry(c3, width=31, bg='white', fg='black')
        self.txtcover.pack(side=LEFT, padx=5)
        self.txtcover.drop_target_register(DND_FILES)
        ttips.Create(self.txtcover, text=_('Select an image file as front cover by clicking the button'))
        self.btncover = Button(c3, text=_('Cover'), command=self.btnLoadCover)
        self.btncover.pack(side=LEFT)
        ttips.Create(self.btncover, text=_('Select an image file as front cover'))

        self.lbcommposer = Label(c4, text=_('Composer(s)'))
        self.lbcommposer.pack(side=LEFT)
        self.txtcomposer = Entry(c4, width=102, bg='white', fg='black')
        self.txtcomposer.pack(side=LEFT, padx=5)

        self.lbcomment = Label(c5, text=_('Comments'))
        self.lbcomment.pack(side=LEFT, padx=5)
        self.txtcomment = Text(c5, width=105, height=5, bg='white', fg='black')
        self.txtcomment.pack(side=LEFT, pady=15)

        self.txtload_audio = Entry(c6, width=53, bg='white', fg='black')
        self.txtload_audio.pack(side=LEFT, padx=5, pady=2)
        self.txtload_audio.drop_target_register(DND_FILES)
        ttips.Create(self.txtload_audio, text=_('Select an audio file by clicking the button'))
        self.btnload_audio = Button(c6, text=_('Load Audio'), width=15, command=self.btnLoadAudio)
        self.btnload_audio.pack(side=LEFT)
        ttips.Create(self.btnload_audio, text=_('Select an audio file, Ctrl+O'))

        self.btnclear_fields = Button(c6, text=_('Clear Fields'), width=15, command=self.btnClearFields)
        self.btnclear_fields.pack(side=LEFT, padx=5)
        ttips.Create(self.btnclear_fields, text=_('Clear all fields, Ctrl+L'))

        self.btnsave_tags = Button(c6, text=_('Save Tags'), width=16, command=self.btnSaveTags)
        self.btnsave_tags.pack(side=LEFT)
        ttips.Create(self.btnsave_tags, text=_('Save all tags into the audio file, Ctrl+S'))

        self.bgimg = PhotoImage(file='icons/bg.png')

        self.bg = Label(c7, image=self.bgimg)
        self.bg.pack(pady=30)
        self.bg.image = self.bgimg

        self.mouseMenu = Menu(window, tearoff=0)
        self.mouseMenu.add_command(label=_('Cut'))
        self.mouseMenu.add_command(label=_('Copy'))
        self.mouseMenu.add_command(label=_('Paste'))

        # Binds
        window.bind('<Control-O>', lambda e: self.btnLoadAudio())
        window.bind('<Control-o>', lambda e: self.btnLoadAudio())
        window.bind('<Control-S>', lambda e: self.btnSaveTags())
        window.bind('<Control-s>', lambda e: self.btnSaveTags())
        window.bind('<Control-Q>', lambda e: window.destroy())
        window.bind('<Control-q>', lambda e: window.destroy())
        window.bind('<Control-G>', lambda e: webbrowser.open('https://github.com/Alexsussa/eyed3-gtk-gui'))
        window.bind('<Control-g>', lambda e: webbrowser.open('https://github.com/Alexsussa/eyed3-gtk-gui'))
        window.bind('<Control-I>', lambda e: webbrowser.open('https://github.com/Alexsussa/eyed3-gtk-gui/blob/master/LICENSE'))
        window.bind('<Control-i>', lambda e: webbrowser.open('https://github.com/Alexsussa/eyed3-gtk-gui/blob/master/LICENSE'))
        window.bind('<Control-D>', lambda e: webbrowser.open('https://github.com/Alexsussa/eyed3-gtk-gui#eyed3-gtk-gui'))
        window.bind('<Control-d>', lambda e: webbrowser.open('https://github.com/Alexsussa/eyed3-gtk-gui#eyed3-gtk-gui'))
        window.bind('<Control-N>', lambda e: self.check_updates())
        window.bind('<Control-n>', lambda e: self.check_updates())
        window.bind('<Control-H>', lambda e: About.about(self, window=window))
        window.bind('<Control-h>', lambda e: About.about(self, window=window))
        window.bind('<Control-L>', lambda e: self.btnClearFields())
        window.bind('<Control-l>', lambda e: self.btnClearFields())
        window.bind('<Button-3><ButtonRelease-3>', self.mouse)
        self.txtlyrics.dnd_bind('<<Drop>>', self.dnd)
        self.txtcover.dnd_bind('<<Drop>>', self.dnd)
        self.txtload_audio.dnd_bind('<<Drop>>', self.dnd)
Beispiel #28
0
 def showAbout(self):
     dialog = QDialog()
     ui = About()
     ui.setupUi(dialog)
     dialog.exec_()
Beispiel #29
0
from contact import Contact
from about import About
from main import Main
from login import Login
from remote import Remote
from music import Music

app = flask.Flask(__name__)
app.secret_key = settings.secret_key

# Routes
app.add_url_rule('/',
                 view_func=Main.as_view('main'),
                 methods=["GET"])
app.add_url_rule('/about/',
                 view_func=About.as_view('about'),
                 methods=["GET"])
app.add_url_rule('/contact/',
                 view_func=Contact.as_view('contact'),
                 methods=["GET"])
app.add_url_rule('/index/',
                 view_func=Index.as_view('index'),
                 methods=["GET"])
app.add_url_rule('/<page>/',
                 view_func=Main.as_view('main'),
                 methods=["GET"])
app.add_url_rule('/login/',
                 view_func=Login.as_view('login'),
                 methods=["GET", "POST"])
app.add_url_rule('/remote/',
                 view_func=Remote.as_view('remote'),
Beispiel #30
0
 def on_about_clicked(self):
     my_about = About()
     my_about.show()
     my_about.exec_()
Beispiel #31
0
class Main(Ui_MainWindow, QtWidgets.QMainWindow):
    def __init__(self):
        super().__init__()

        self.about: About = None
        self.norm_table: Dict[int:float] = None
        self.btc_table: Dict[int:float] = None

        self.num_from_c = None

        self.norm_rates()
        self.init_ui()
        self.signals()
        self.separator(1)
        self.cc_show()

    def init_ui(self):
        self.setupUi(self)
        self.setFixedSize(290, 200)
        self.menuSeparator.setToolTipsVisible(True)
        self.actiontext.setToolTip('By default it\'s Dot')
        self.show()

    def signals(self):
        self.btc.triggered.connect(self.cc_show)
        self.exchange.clicked.connect(self.change_rates)
        self.btc_rates_btn.clicked.connect(self.btc_rates)
        self.firstC.currentIndexChanged.connect(self.norm_operations)
        self.secondC.currentIndexChanged.connect(self.norm_operations)
        self.secondC_2.currentIndexChanged.connect(self.btc_operations)
        self.firstCINP.textChanged.connect(self.norm_operations)
        self.firstCINP_2.textChanged.connect(self.btc_operations)
        self.actionRates.triggered.connect(self.norm_rates)
        self.actionDot.triggered.connect(lambda: self.separator(1))
        self.actionComma.triggered.connect(lambda: self.separator(22))
        self.actionAbout.triggered.connect(self.initiate_about)

    @property
    def index_first_c(self) -> int:
        return self.firstC.currentIndex()

    @property
    def index_second_c(self) -> int:
        return self.secondC.currentIndex()

    @property
    def index_second_c_btc(self) -> int:
        return self.secondC_2.currentIndex()

    def change_rates(self):
        index_one, index_two = self.index_first_c, self.index_second_c
        self.secondC.setCurrentIndex(index_one)
        self.firstC.setCurrentIndex(index_two)

    def norm_rates(self):
        try:
            params_for_var = 'USD,BGN,RUB,HRK,INR,NOK,PLN,TRY'
            request_api = requests.get(
                f'https://api.exchangeratesapi.io/latest?symbols={params_for_var}',
                timeout=2)
            norm_value = request_api.json()
        except requests.ConnectionError:
            QtWidgets.QMessageBox.critical(
                self, 'Connection Error', 'There was a network error.'
                '\nTry to download the rates manually'
                '\nby pressing <Rates> button in <Help> menu')
            return None
        except:
            return None

        self.norm_table = {
            0: 1,
            1: norm_value['rates']['USD'],
            2: norm_value['rates']['BGN'],
            3: norm_value['rates']['RUB'],
            4: norm_value['rates']['HRK'],
            5: norm_value['rates']['INR'],
            6: norm_value['rates']['NOK'],
            7: norm_value['rates']['PLN'],
            8: norm_value['rates']['TRY'],
        }

    def btc_rates(self):
        try:
            request_api = requests.get('https://blockchain.info/ticker')
            btc_value = request_api.json()
        except requests.ConnectionError:
            QtWidgets.QMessageBox.critical(
                self, 'Connection Error', 'There was a network error.'
                '\nTry to download the rates manually'
                '\nby pressing <Rates> button in <Help> menu')
            return None
        except:
            return None

        self.btc_table = {
            0: btc_value['EUR']['last'],
            1: btc_value['USD']['last'],
            2: btc_value['USD']['last'],
            3: btc_value['RUB']['last'],
            4: btc_value['INR']['last'],
        }

    def norm_operations(self):
        if len(self.firstCINP.text()) == 0:
            self.secondCOUT.clear()
            return None

        try:
            str_inp = self.firstCINP.text()
            self.num_from_c = float(str_inp.replace(',', '.'))

            out = self.rates_return()

            format_and_round = format(round(out, 3), ',')
            self.secondCOUT.setText(format_and_round)
        except:
            return None

    def btc_operations(self):
        if len(self.firstCINP_2.text()) == 0:
            self.secondCOUT_2.clear()
            return None

        try:
            str_inp = self.firstCINP_2.text()
            self.num_from_c = float(str_inp.replace(',', '.'))

            out = self.btc_return()

            format_and_round = format(round(out, 3), ',')
            self.secondCOUT_2.setText(format_and_round)
        except:
            return None

    def rates_return(self) -> float:
        return (self.num_from_c * self.norm_table[self.index_second_c]
                ) / self.norm_table[self.index_first_c]

    def btc_return(self) -> float:
        if self.secondC_2.currentIndex() == 2:
            return (self.num_from_c * self.btc_table[0]) * self.norm_table[2]
        return self.num_from_c * self.btc_table[self.index_second_c_btc]

    def separator(self, sep: int):
        var = QtGui.QDoubleValidator(
            QtCore.QLocale.setDefault(QtCore.QLocale(sep)))
        self.firstCINP.clear()
        self.secondCOUT.clear()
        self.firstCINP_2.clear()
        self.secondCOUT_2.clear()
        self.firstCINP.setValidator(var)
        self.firstCINP_2.setValidator(var)

    def cc_show(self):
        if self.btc.isChecked():
            self.frame_8.show()
            self.line.show()
            self.setFixedSize(290, 370)
            self.btc_rates()
        else:
            self.frame_8.close()
            self.line.close()
            self.firstCINP_2.clear()
            self.secondCOUT_2.clear()
            self.setFixedSize(290, 200)

    def initiate_about(self):
        self.about = About()
        self.about.setFixedSize(398, 280)
        self.about.show()
Beispiel #32
0
 def _about(self):
     About()
Beispiel #33
0
def getVersion():
    about = About()
    about.read(csnUtility.GetRootOfCSnake() + "/resources/about.txt")
    return about.getVersion()
Beispiel #34
0
def getVersion():
    about = About()
    about.read(csnUtility.GetRootOfCSnake() + "/resources/about.txt")
    return about.getVersion()
Beispiel #35
0
class Main(QtGui.QMainWindow):
    def __init__(self):
        QObject.__init__(self)
        self.cuadros = []
        self.casillas = []
        QtGui.QMainWindow.__init__(self)
        QtGui.QMessageBox.information(self, "Bienvenido a sudoku", "Bienvenido a QSudoku. Version 0.2.05")
        self.ui=Ui_MainTable()
        self.ui.setupUi(self)
        self.initGuiCelda()
        self.initMenuBar()
        self.initTeclado()
                
        #formulario de niveles
        self.level = Nivel()
        QObject.connect(self.level, SIGNAL("nivel"), self.iniciarJuego)
        self.ui.crono.display("00:00")
        self.bandera = True
        
        
    def initGuiCelda(self):
        self.ui.cmdVerificar.setEnabled(False)
        self.ui.cmdHint.setEnabled(False)
        self.ui.tablero.setHorizontalSpacing(8)
        self.ui.tablero.setVerticalSpacing(8)
        self.casillas = []
        z=0
        fil = 0
        col = 0
        for i in range(0,3):
            fil = i*3
            for j in range(0,3):
                col = j*3
                cuadro = QtGui.QGridLayout()
                cuadro.setHorizontalSpacing(1)
                cuadro.setVerticalSpacing(1)
                for l in range(0,3):
                    for m in range(0,3):
                        cas = Celda(fil, col, 0)
                        self.casillas.append(cas)
                        cuadro.addWidget(cas,l,m)
                        z = z+1
                        col = col +1
                    fil = fil +1
                    col = j*3
                self.ui.tablero.addLayout(cuadro, i, j)
                fil = i*3
        self.celdaRuntime = Celda(0,0,0)
        self.tm = QTime(0,0,0,0)
        
                
    def initCrono(self):
        self.tiempo = QTimer(self)
        QObject.connect(self.tiempo, SIGNAL("timeout()"), self.timeRefresh)
        self.tiempo.start(1000)
        self.tiempoIni = QTime.currentTime()
        QTimer.singleShot(1000, self.timeRefresh)
        
    def timeRefresh(self):
        actual = QTime.currentTime()
        m_ini = self.tiempoIni.minute()
        s_ini = self.tiempoIni.second()
        ms_ini = self.tiempoIni.msec()
        m_act = actual.minute()
        s_act = actual.second()
        ms_act = actual.msec()
        
        if ms_act < ms_ini:
            ms_act = 1000 + ms_act
            s_act = s_act +1
        if s_act < s_ini:
            s_act = 60 + s_act
            m_act = m_act - 1
            
        m = m_act - m_ini
        s = s_act - s_ini
        ms = ms_act - ms_ini
        #actualizo el tiempo
        
        self.tm.setHMS(0, m, s, ms)
        self.ui.crono.display(self.tm.toString("mm:ss")) 
    
    def initMenuBar(self):
        QObject.connect(self.ui.actionAcerca_de, SIGNAL("triggered()"), self.acercaDe)
        QObject.connect(self.ui.actionNueva, SIGNAL("triggered()"), self.nuevaPartida)
        QObject.connect(self.ui.actionGuardar, SIGNAL("triggered()"), self.guardarPartida)
        QObject.connect(self.ui.actionCargar, SIGNAL("triggered()"), self.cargarPartida)
        QObject.connect(self.ui.actionSalir, SIGNAL("triggered()"), self.salirJuego)
        QObject.connect(self.ui.actionRanking, SIGNAL("triggered()"), self.verRanking)
        
    def verRanking(self):
        self.ranking = Ranking()
        self.ranking.setWindowModality(Qt.ApplicationModal)
        self.ranking.show()
        
    
    def salirJuego(self):
        puntaje = self.calcularPuntaje()
        QtGui.QMessageBox.about(self, "Salir", "Su puntaje fue de : "+ str(puntaje))
        self.close()
        self.destroy()
    
    def acercaDe(self):
        print "entra a acerca de :)"
        self.ab = About()
        self.ab.setWindowModality(Qt.ApplicationModal)
        self.ab.show()

    def nuevaPartida(self):
        self.level.show()
    
       
    def iniciarJuego(self, nivel):
        self.level.hide()
        self.activarTeclado()
        self.setCeldasBlanco()
        self.setTableroInicio()
        self.setTableroInicialSegunNivel(nivel)
        self.setTableroEnPantalla()
        while True:
            self.nombre, valor = QtGui.QInputDialog.getText(self, "Sudoku", "Ingrese su nombre")
            if self.nombre == "" or valor==False:
                QtGui.QMessageBox.warning(self, "Mensaje", "No se ha ingresado texto")
            else:
                break
        self.ui.lbl_jugador.setText(self.nombre)
        if nivel==0:
            self.ui.lbl_level.setText("Novato")
            self.hints = 12
            self.dificultad = 0
        elif nivel==1:
            self.ui.lbl_level.setText("Intermedio")
            self.hints = 8
            self.dificultad = 1
        elif nivel==2:
            self.ui.lbl_level.setText("Profesional")
            self.hints = 4
            self.dificultad = 2
        elif nivel==3:
            self.ui.lbl_level.setText("Leyenda")
            self.hints = 2
            self.dificultad = 3
        self.initCrono()
        self.ui.cmdHint.setText("Hints "+str(self.hints))
        
    def setTableroEnPantalla(self):
        for i in range(0,9):
            for j in range(0,9):
                tmp = self.tableroActual[i][j]
                if tmp!= 0:
                    self.ui.tablero.itemAtPosition(i/3, j/3).itemAtPosition(i%3, j%3).widget().setValue(tmp)
                else:
                    self.ui.tablero.itemAtPosition(i/3, j/3).itemAtPosition(i%3, j%3).widget().setValue(0)
                    
        
    def setTableroInicialSegunNivel(self, nivel):
        if nivel==0:
            for i in range(0,50):
                fila = randint(0,8)
                col = randint(0,8)
                self.tableroActual[fila][col] = self.matriz[fila][col]
                
        if nivel==1:
            for i in range(0,40):
                fila = randint(0,8)
                col = randint(0,8)
                self.tableroActual[fila][col] = self.matriz[fila][col]
            
        if nivel==2:
            for i in range(0,30):
                fila = randint(0,8)
                col = randint(0,8)
                self.tableroActual[fila][col] = self.matriz[fila][col]
                
        if nivel==3:
            for i in range(0,25):
                fila = randint(0,8)
                col = randint(0,8)
                self.tableroActual[fila][col] = self.matriz[fila][col]    
        print self.tableroActual
        
        
    def setTableroInicio(self):
        matrizSolucion = GenMatriz()
        self.matriz = [ [ 0 for i in range(9) ] for j in range(9) ]
        self.tableroActual = [ [ 0 for i in range(9) ] for j in range(9) ]
        self.matriz = matrizSolucion.matriz
        print "imprimiendo matriz de juego main: \n" 
        print self.matriz
            
        
    def setCeldasBlanco(self):
        for i in range(0,9):
            for j in range(0,9):
                self.ui.tablero.itemAtPosition(i/3, j/3).itemAtPosition(i%3, j%3).widget().setBackColor("white")
        
        
    def activarTeclado(self):
        for i in range(0,10):
            self.teclado[i].setEnabled(True)
        self.ui.cmdHint.setEnabled(True)
        self.ui.cmdVerificar.setEnabled(True)
        QObject.connect(self.ui.cmdHint, SIGNAL("clicked()"), self.cmdHint_clicked)
        QObject.connect(self.ui.cmdVerificar, SIGNAL("clicked()"), self.cmdVerificar_clicked)
        for i in range(0,81):
            cas = self.casillas[i]
            QObject.connect(cas, SIGNAL("clicked()"), cas.setEmpty)
            QObject.connect(cas, SIGNAL("clicked()"), self.getCeldaRuntime)
        
        
    def initTeclado(self):
        z=0
        self.teclado = []
        for i in range(0,3):
            for j in range(0,3):
                cmd = QtGui.QPushButton(str(z+1))
                cmd.setEnabled(False)
                self.teclado.append(cmd)
                QObject.connect(self.teclado[z], SIGNAL("clicked()"), self.numPressed)
                print "entra "+str(z)
                self.ui.tecladoNum.addWidget(self.teclado[z],i,j)
                z = z+1
        cmd = QtGui.QPushButton("0")
        cmd.setEnabled(False)
        self.teclado.append(cmd)
        QObject.connect(self.teclado[z], SIGNAL("clicked()"), self.numPressed)
        self.ui.tecladoNum.addWidget(self.teclado[z], 4, 1)
    
    def numPressed(self):
        numeroASetear = int(self.sender().text())
        self.celdaRuntime.setValue(numeroASetear)
        
    def getCeldaRuntime(self):
        if self.celdaRuntime:
            print "entra a resetear y colocar borde"
            self.celdaRuntime.reset()
            self.celdaRuntime.setBlackBorder()
        if self.bandera == False:
            self.volverTableroNormal()
            self.bandera = True
        self.celdaRuntime = self.sender()
        self.setTableroActual()
        self.setPistas()
        
    def setTableroActual(self):
        print "dentro de setTableroActual"
        try:
            print self.tableroActual
            for i in range(0,9):
                for j in range(0,9):
                    tmp = self.ui.tablero.itemAtPosition(i/3, j/3).itemAtPosition(i%3, j%3).widget().getValue()
                    self.tableroActual[i][j] = tmp
        except AttributeError:
            print "Aun no se inicializado tableroActual... :("
        
        
    def setPistas(self):
        pistas = [1,2,3,4,5,6,7,8,9]
        fila = self.celdaRuntime.fila
        columna = self.celdaRuntime.columna
        print "fila: " +str(fila) + "columna: " +str(columna)
        print "pista en fila"
        try:
            for i in range(0,9):
                tmp = self.tableroActual[fila][i]
                print tmp
                if tmp!=0:
                    pistas[tmp-1]=0
            print "pista en columna"
            for j in range(0,9):
                tmp = self.tableroActual[j][columna]
                print tmp
                if tmp!= 0:
                    pistas[tmp-1]=0
            l = (((columna/3)+1)+(fila/3)*3)
            for i in range((((l-1)/3)*3),((((l-1)/3)*3)+3)):
                for j in range((((l-1)%3)*3),((((l-1)%3)*3)+3)):
                    tmp = self.tableroActual[i][j]
                    if tmp != 0:
                        pistas[tmp-1]=0
                    
        except AttributeError:
            print "Aun no se inicializado tableroActual... :("
        k = 0
        print "pistas: "
        print pistas
        for j in range(0,9):
            tmp = pistas[j]
            if tmp!=0 & k<5:
                self.celdaRuntime.addHints(tmp)
                k = k+1
                
    def guardarPartida(self):
        g = Guardar()
        try:
            self.setTableroActual()
            g.guardarValores(self.matriz, self.tableroActual, self.nombre, self.ui.lbl_level.text(), self.tm.toString())
            if g.crearArchivo() == True:
                print "se creo archivo"
            else:
                print "cancelo o ocurrio algun error :("
        except AttributeError:
            print "no ha empezado a jugar..."
            QtGui.QMessageBox.about(self, "Mensaje", "Aun no has empezado a jugar...  intentalo   :)")
        
        
    
    def cargarPartida(self):
        g = Guardar()
        if g.leerArchivo() == True:
            self.tableroActual = g.matriz
            self.matriz = g.matriz
            self.nombre = g.nombre
            self.ui.lbl_jugador.setText(g.nombre)
            self.ui.lbl_level.setText(g.nivel)
            self.setTableroEnPantalla()
            self.activarTeclado()
            self.setCeldasBlanco()
            self.initCrono()
        else:
            return
        
    def checkFila(self, fila, col):
        for i in range(0,9):
            if i!=col:
                if self.tableroActual[fila][i] == self.tableroActual[fila][col]:
                    print "Error en fila "+str(fila+1)
                    return False
        return True
    
    def checkColumna(self, fila, col):
        for i in range(0,9):
            if i!=fila:
                if self.tableroActual[i][col] == self.tableroActual[fila][col]:
                    print "Error en la columna " + str(col+1)
                    return False
        return True
    
    def chechCuadro(self, fila, col):
        v_cuadro = int(fila/3)
        h_cuadro = int(col/3)
        for i in range(v_cuadro*3,v_cuadro*3+3):
            for j in range(h_cuadro*3,h_cuadro*3+3):
                if i != fila or j != col:
                    if self.tableroActual[fila][col] == self.tableroActual[i][j]:
                        print "Error en el cuadro: "+str(fila)+","+str(col)
                        return False
        return True
    
    def cmdVerificar_clicked(self):
        t = True
        self.setTableroActual()
        for i in range(0,9):
            for j in range(0,9):
                self.ui.tablero.itemAtPosition(i/3, j/3).itemAtPosition(i%3, j%3).widget().setBackColor("white")
                if self.checkFila(i, j)==False:
                    #pintar las celdas de Rojo
                    self.ui.tablero.itemAtPosition(i/3, j/3).itemAtPosition(i%3, j%3).widget().setBackColor("red")
                    self.ui.tablero.itemAtPosition(i/3, j/3).itemAtPosition(i%3, j%3).widget().setBlackBorder()
                    t = False
                if self.checkColumna(i, j)==False:
                    #pintar las celdas de rojo
                    self.ui.tablero.itemAtPosition(i/3, j/3).itemAtPosition(i%3, j%3).widget().setBackColor("red")
                    self.ui.tablero.itemAtPosition(i/3, j/3).itemAtPosition(i%3, j%3).widget().setBlackBorder()
                    t = False
                if self.chechCuadro(i, j)==False:
                    #pintar las celdas de rojo
                    self.ui.tablero.itemAtPosition(i/3, j/3).itemAtPosition(i%3, j%3).widget().setBackColor("red")
                    self.ui.tablero.itemAtPosition(i/3, j/3).itemAtPosition(i%3, j%3).widget().setBlackBorder()
                    t = False
        if t==True:
            QtGui.QMessageBox.about(self, "Felicitaciones", "Sudoku Resuleto Correctamente")
        else:
            QtGui.QMessageBox.about(self, "Mensaje", "Sudoku resuleto incorrectamente")
        self.bandera = False


    def volverTableroNormal(self):
        for i in range(0,9):
            for j in range(0,9):
                self.ui.tablero.itemAtPosition(i/3, j/3).itemAtPosition(i%3, j%3).widget().setBackColor("white")
        
    def cmdHint_clicked(self):
        print "proximamente lo implementaremos"
        if self.hints > 0:
            self.hints = self.hints-1
            self.sender().setText("Hints "+str(self.hints))
            self.setTableroActual()
            while True:
                irnd = randint(1,8)
                jrnd = randint(1,8)
                if self.tableroActual[irnd][jrnd] == 0:
                    break
            self.tableroActual[irnd][jrnd] = self.matriz[irnd][jrnd]
            self.ui.tablero.itemAtPosition(irnd/3, jrnd/3).itemAtPosition(irnd%3, jrnd%3).widget().setValue(self.tableroActual[irnd][jrnd])
            self.setTableroEnPantalla()
        else:
            QtGui.QMessageBox.about(self, "Mensaje", "No le quedan mas ayudas :(")
            self.ui.cmdHint.setEnabled(False)
        
                    
    def calcularPuntaje(self):
        b=0
        for i in range(0,9):
            for j in range(0,9):
                try:
                    a = self.tableroActual[i][j]
                except AttributeError:
                    print "aun no ha empezado a jugar"
                    return 0 
                if a!=0:
                    b = b+1  
        if self.dificultad == 0:
            return (b-30)*10-self.tm.minute()
        if self.dificultad == 1:
            return (b-30)*10-self.tm.minute()
        if self.dificultad == 2:
            return (b-30)*10-self.tm.minute()
        if self.dificultad == 3:
            return (b-30)*10-self.tm.minute()
        return 0
Beispiel #36
0
 def about(self):
     self.dlg = About(self.default_cbk)
     self.dlg.run()
Beispiel #37
0
 def check_update_value(self):
     if not self.ui_is_locked():
         idx = self.body.current()
         BLOG.set_blog(idx)
         self.dlg = BlogManager(self.default_cbk,self.blogs[idx]['account'])
         self.dlg.run()
Beispiel #38
0
    def __init__(self):
        super().__init__()
        self.version = 1.1
        self.icon = self.processIcon(app_icon)

        # Add window icon
        self.setWindowIcon(self.icon)
        self.setupUi(self)
        self.setStyleSheet(load_stylesheet())

        # Main Props
        self.scanner = Scanner()
        self.killer = Killer()

        # Settings props
        self.minimize = True
        self.remember = False

        self.from_tray = False

        # We send elmocut to the settings window
        self.settings_window = Settings(self, self.icon)
        self.about_window = About(self, self.icon)

        self.applySettings()

        # Threading
        self.scan_thread = ScanThread()
        self.scan_thread.thread_finished.connect(self.ScanThread_Reciever)
        self.scan_thread.progress.connect(self.pgbar.setValue)

        # Connect buttons
        self.buttons = [
            (self.btnScanEasy, self.scanEasy, scan_easy_icon, 'Arping Scan'),
            (self.btnScanHard, self.scanHard, scan_hard_icon, 'Pinging Scan'),
            (self.btnKill, self.kill, kill_icon, 'Kill selected device'),
            (self.btnUnkill, self.unkill, unkill_icon,
             'Un-kill selected device'),
            (self.btnKillAll, self.killAll, killall_icon, 'Kill all devices'),
            (self.btnUnkillAll, self.unkillAll, unkillall_icon,
             'Un-kill all devices'),
            (self.btnSettings, self.openSettings, settings_icon,
             'View elmoCut settings'),
            (self.btnAbout, self.openAbout, about_icon, 'About elmoCut')
        ]

        for btn, btn_func, btn_icon, btn_tip in self.buttons:
            btn.setToolTip(btn_tip)
            btn.clicked.connect(btn_func)
            btn.setIcon(self.processIcon(btn_icon))

        self.pgbar.setVisible(False)

        # Table Widget
        self.tableScan.itemClicked.connect(self.deviceClicked)
        self.tableScan.cellClicked.connect(self.cellClicked)
        self.tableScan.setColumnCount(4)
        self.tableScan.verticalHeader().setVisible(False)
        self.tableScan.setHorizontalHeaderLabels(
            ['IP Address', 'MAC Address', 'Vendor', 'Type'])
        '''
           System tray icon and it's tray menu
        '''
        show_option = QAction('Show', self)
        hide_option = QAction('Hide', self)
        quit_option = QAction('Quit', self)
        kill_option = QAction(self.processIcon(kill_icon), '&Kill All', self)
        unkill_option = QAction(self.processIcon(unkill_icon), '&Unkill All',
                                self)

        show_option.triggered.connect(self.show)
        hide_option.triggered.connect(self.hide_all)
        quit_option.triggered.connect(self.quit_all)
        kill_option.triggered.connect(self.killAll)
        unkill_option.triggered.connect(self.unkillAll)

        tray_menu = QMenu()
        tray_menu.addAction(show_option)
        tray_menu.addAction(hide_option)
        tray_menu.addSeparator()
        tray_menu.addAction(kill_option)
        tray_menu.addAction(unkill_option)
        tray_menu.addSeparator()
        tray_menu.addAction(quit_option)

        self.tray_icon = QSystemTrayIcon(self)
        self.tray_icon.setIcon(self.icon)
        self.tray_icon.setToolTip('elmoCut')
        self.tray_icon.setContextMenu(tray_menu)
        self.tray_icon.show()
        self.tray_icon.activated.connect(self.tray_clicked)
	def showAbout(self):
		self.popup1=About()
		self.popup1.exec_()
Beispiel #40
0
	def about(self):
		about_win = Toplevel()
		about_win.title("About")
		ab = About(about_win)
		about_win.mainloop()
Beispiel #41
0
# ----------------------------------------
# controllers
# ----------------------------------------

# @app.route('/favicon.ico')
# def favicon():
# 	return send_from_directory(os.path.join(app.root_path, 'static'), 'ico/favicon.ico')

# Routes
# Static main view
# Static main view
app.add_url_rule("/", view_func=Main.as_view("main"), methods=["GET"])
# Dynamic URL rule
app.add_url_rule("/login/", view_func=Login.as_view("login"), methods=["GET", "POST"])
app.add_url_rule("/plans/", view_func=Plans.as_view("plans"), methods=["GET", "POST"])
app.add_url_rule("/about/", view_func=About.as_view("about"), methods=["GET", "POST"])

# @app.errorhandler(404)
# def page_not_found(e):
# 	return render_template('404.html'), 404

# @app.route("/")
# def index():
# 	return render_template('index.html')

# @app.route("/about")
# def about():
# 	return render_template('about.html')

# @app.route("/plans")
# def plans():
Beispiel #42
0
 def build(self, *a):
     self.connect("delete-event", self.quit_app)
     self.set_default_size(1000, 700)
     self.maximize()
     self.set_icon_name('gscrabble')
     self.set_title(_('Golden Scrabble'))
     self.set_titlebar(self.hd_bar)
     self.axl = Gtk.AccelGroup()
     self.add_accel_group(self.axl)
     #============================================
     self.stack.set_transition_type(Gtk.StackTransitionType.CROSSFADE)
     self.stack.set_transition_duration(200)
     #============================================
     self.hb_window = Gtk.Box(spacing=0,
                              orientation=Gtk.Orientation.HORIZONTAL)
     self.vb_letters = Gtk.Box(spacing=0,
                               orientation=Gtk.Orientation.VERTICAL)
     self.vb_letters.pack_start(self.objs1, False, False, 0)
     self.objs1.set_no_show_all(True)
     self.vb_letters.pack_start(self.sideletters, True, True, 0)
     #----------------------------------------------------------------------------------
     self.hb_window.pack_start(self.vb_letters, False, False, 0)
     self.hb_window.pack_start(self.chequer, True, True, 0)
     self.hb_window.pack_start(self.sideinfo, False, False, 0)
     #---------------------------------------------------------------------------------
     self.stack.add_named(self.pagestarting, 'n0')
     self.stack.add_named(self.hb_window, 'n1')
     #---------------------------------------------------------------------------------
     self.sideletters.enable_model_drag_source(
         Gdk.ModifierType.BUTTON1_MASK, [], Gdk.DragAction.COPY)
     self.sideletters.drag_source_set_target_list(None)
     self.sideletters.drag_source_add_text_targets()
     self.chequer.drag_dest_set(Gtk.DestDefaults.ALL, [],
                                Gdk.DragAction.COPY)
     self.chequer.drag_dest_set_target_list(None)
     self.chequer.drag_dest_add_text_targets()
     self.add(self.stack)
     #------------------------------------------------------------------------------------
     self.axl.connect(Gdk.KEY_F11, 0, Gtk.AccelFlags.VISIBLE,
                      self.set_fullscreen_cb)
     self.axl.connect(Gdk.KEY_W, 0, Gtk.AccelFlags.VISIBLE,
                      self.hd_bar.help_me_letters)
     self.axl.connect(Gdk.KEY_U, 0, Gtk.AccelFlags.VISIBLE,
                      self.hd_bar.undo_added)
     self.axl.connect(Gdk.KEY_S, 0, Gtk.AccelFlags.VISIBLE,
                      self.hd_bar.skip_2_computer)
     self.axl.connect(Gdk.KEY_C, 0, Gtk.AccelFlags.VISIBLE,
                      self.hd_bar.change_my_letters)
     self.axl.connect(Gdk.KEY_O, 0, Gtk.AccelFlags.VISIBLE,
                      self.hd_bar.apply_added)
     self.axl.connect(Gdk.KEY_G, 0, Gtk.AccelFlags.VISIBLE,
                      self.hd_bar.mepref.restart_game)
     self.axl.connect(Gdk.KEY_Q, ACCEL_CTRL_MOD, Gtk.AccelFlags.VISIBLE,
                      self.quit_app)
     self.axl.connect(Gdk.KEY_P, 0, Gtk.AccelFlags.VISIBLE,
                      lambda *a: DialogPreference(self))
     self.axl.connect(Gdk.KEY_A, 0, Gtk.AccelFlags.VISIBLE,
                      lambda *a: About(self))
     #------------------------------------------------------------------------------------
     self.show_all()
     self.load()
Beispiel #43
0
class QdvGrab(QMainWindow):


    def __init__(self, parent=None):
        super(QdvGrab, self).__init__(parent)
        self.setupUi()
        self.connectActions()
        self.updateUi()

        QTimer.singleShot(0, self.loadSettings)

        self.ui.statusbar = QStatusBar()
        message = str("Welcome to DvGrab {}".format(app_version))
        self.ui.statusbar.showMessage(message)
        print(message)

    def centerScreen(self):
        """
        We keep the windows geometry modified by the user either this one by default
        :param self:
        :return:
        """
        geometry_window = ""

        #we catch variables (width/height)
        if geometry_window:
            self.resize(geometry_window[0], geometry_window[1])
        else:
            geometry_window = (self.geometry().width(), self.geometry().height())

        #we catch the window size on the screen
        size_screen = QDesktopWidget().screenGeometry()
        self.move(((size_screen.width() - geometry_window.width())/2), ((size_screen.height() - geometry_window.height()))/2)
    #===================================================================================================================

    def loadSettings(self):


        settings = QSettings()

        new_output_path = settings.value("output_default_path")
        name_camcorder = settings.value("name_camcorder")
        formats_choose = settings.value("formats_choose")
        automatic_conversion = settings.value("automatic_conversion")
        detection_scene = settings.value("detection_scene")
        automatic_record = settings.value("automatic_record")

        if new_output_path:
            self.ui.lneoutputfile.setText(new_output_path)
        if name_camcorder:
            self.ui.lnenamecamecorder.setText(name_camcorder)
        if formats_choose:
            self.ui.cmbformatcapture.setCurrentIndex(formats_choose)
        if automatic_conversion:
            self.ui.chknone.setChecked(True)
        if detection_scene:
            self.ui.chkdetection.setChecked(True)
        if automatic_record:
            self.ui.chkautomaticrecord.setChecked(True)

    # ==================================================================================================================
    def setupUi(self):

        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        #Set Tooltips for the main gui
        self.ui.btnacquisitiondv.setToolTip(self.tr(" Choose the Dv Acquisition mode "))
        self.ui.lblcamcorder.setToolTip(self.tr(" Set the Camcorder Name "))
        self.ui.lblfree.setToolTip(self.tr(" Set the free space disk available "))
        self.ui.lblused.setToolTip(self.tr(" Set the used space disk "))
        self.ui.lbltotal.setToolTip(self.tr(" Set the total space disk not and available "))
        self.ui.btnrecordmpeg.setToolTip(self.tr(" Choose the HDV Acquisition mode "))
        self.ui.btnstartrecord.setToolTip(self.tr(" Run the film acquisition "))
        self.ui.btnpreferences.setToolTip(self.tr(" Set the Preferences Screen "))
        self.ui.btnhelp.setToolTip(self.tr("  "))
        self.ui.btnquit.setToolTip(self.tr(" Exit the application "))

        #Set Status Tips for the main gui in the statusBar()
        self.ui.lblcamcorder.setStatusTip(self.tr('The camcorder name is '))
        self.ui.lblfree.setStatusTip(self.tr('The free space disk available is of '))
        self.ui.lblused.setStatusTip(self.tr('The space disk used is of '))
        self.ui.lbltotal.setStatusTip(self.tr('The total space disk is of '))
        self.ui.btnacquisitiondv.setStatusTip(self.tr('Dv Acquisition mode is used'))
        self.ui.btnrecordmpeg.setStatusTip(self.tr('HDV Acquisition mode is used'))
        self.ui.btnstartrecord.setStatusTip(self.tr('The process is run'))
        self.ui.btnpreferences.setStatusTip(self.tr('Preferences Screen has been called'))
        self.ui.btnhelp.setStatusTip(self.tr('The web help oneline is opened'))
        self.ui.btnquit.setStatusTip(self.tr('Exit'))

    # ==================================================================================================================
    def connectActions(self):

        """
        Function making connections not done by Qt Designer

        """
        self.ui.btnacquisitiondv.clicked.connect(self.Recording)
        self.ui.btnrecordmpeg.clicked.connect(self.Recording)
        self.ui.btnstartrecord.clicked.connect(self.Acquisition)
        self.ui.btnpreferences.clicked.connect(self.run_preferences_screen)
        self.ui.btnhelp.clicked.connect(self.Help)
        self.ui.btnquit.clicked.connect(self.Quit)

        self.ui.actionOpen_Directory.triggered.connect(self.openDirectory)
        self.ui.actionQuit.triggered.connect(self.Quit)
        self.ui.actionPreferences.triggered.connect(self.run_preferences_screen)
        self.ui.actionAbout_Qt.triggered.connect(self.AboutQt)
        self.ui.actionAbout_QdvGrab.triggered.connect(self.AboutQdvgrab)
        self.ui.actionHelp.triggered.connect(self.Help)

    # ==================================================================================================================
    def updateUi(self):

        self.ui.lnecapturename.setText("My Awesome Movie")
        self.ui.lnecapturename.setFocus()
        self.ui.lnecapturename.selectAll()

    # ==================================================================================================================
    def Recording(self):

        """
        Run the type of acquisition asked

        """
        pass

    # ==================================================================================================================
    def Acquisition(self):

        """
        Run the acquisition process i.e run dvgrab

        """
        pass

    # ==================================================================================================================
    def Help(self):

        """
        Call the help webpage on Github

        """

        try:
            webbrowser.open("https://github.com/olielvewen/QDvGrab/wiki")
            print("Website wiki project is opened")
        except:
            QMessageBox.information(self, self.tr("QdvGrab - Error"), self.tr("Unable to open the Wiki page"))
            print("Impossible to open the wiki page")

    # ==================================================================================================================
    def Quit(self):

        """
        Close properly the application

        """

        application.quit()

    # ==================================================================================================================
    def run_preferences_screen(self):

        """
        Run the Preferences Dialog

        """

        self.windo = PreFerences()
        self.windo.show()

    # ==================================================================================================================
    def closeEvent(self, event):

        """
        function run just before the mainwindow is closed and stop all work in progress and save settings
         """

        #stop work in progress if there are one


        #Save all settings if they have done modified
        PreFerences.saveSettings()

        event.accept()

    #===================================================================================================================
    def openDirectory(self,new_output_path):

        """
        Open the directory choose by the user either open this one by default
        :param new_output_path:
        :return:
        """
        if new_output_path:
            preferences.PreFerences.outputPath()
        else:
            new_output = QFileDialog.getExistingDirectory(self, self.tr("QDvGrab - Choose a Directory"), os.path.join(QDir.homePath() + "/Videos/"))

    #===================================================================================================================
    def AboutQt(self):

        """
        Method helping you to know which version of Qt you are using displaying an nice window

         """

        QMessageBox.aboutQt(QdvGrab)

    #===================================================================================================================
    def AboutQdvgrab(self):

        """
        Run the About Dialog

        """

        self.windo = About()
        self.windo.show()

    #===================================================================================================================
    def logInfo(self):

        """
        method for getting info about what user have done  in the configfile - necessary for debugging - probably will be
        replace in the future by logging function

        """
        pass
    #===================================================================================================================
    def onCaptureProgress(self):

        """
        update the progression of the progressbar

        """
        pass

    #===================================================================================================================
    def checkSizeDisk(self):

        """
        method for getting the size (free or not) of the hard drive

        """
        pass

    #===================================================================================================================
    def getDevice(self):

        """
        method for getting the mounting point and the name (?) of the camcorder

        """
        pass

    #===================================================================================================================
    def creationProcess(self):

        """
        method for create the command line

        """
        pass
Beispiel #44
0
 def about(self, widget):
     about = About()
     about.show()
Beispiel #45
0
 def about(self):
     about = About(self)
     about.exec_()
Beispiel #46
0
    def eventFilter(self, receiver, event):
        """will be called for all events"""
        from log import EventData
        EventData(receiver, event)
        return QObject.eventFilter(self, receiver, event)


from util import gitHead

if os.name == 'nt':
    _ = os.path.dirname(os.path.realpath(__file__))
    if _.endswith('.zip'):
        # cx_freeze
        os.chdir(os.path.dirname(_))

ABOUT = About()
KCmdLineArgs.init(sys.argv, ABOUT.about)
KCmdLineArgs.addCmdLineOptions(defineOptions())
APP = KApplication()
parseOptions()

if hasattr(QGuiApplication, 'setDesktopFileName'):
    QGuiApplication.setDesktopFileName('org.kde.kajongg')

if Debug.neutral:
    KGlobal.translation = None

if Debug.events:
    EVHANDLER = EvHandler()
    APP.installEventFilter(EVHANDLER)
class Gui(QtGui.QMainWindow,QtGui.QWidget):

	def __init__(self):
		super(Gui, self).__init__()
		self.speaker = ""
		self.directory = ""
		self.type = ""
		self.line=0
		self.text=[]
		self.decode=""
		self.fname="output"
		self.rec=0
		self.initUI()
		self.file = ""

	def initUI(self):
		self.setWindowIcon(QtGui.QIcon('logo.png'))
		self.vr = VoiceRec()
		self.pl = Play()
		self.vrThread = QThread()
		self.plThread = QThread()
		self.vr.moveToThread(self.vrThread)
		self.pl.moveToThread(self.plThread)

		self.figure = plt.figure(1)
		self.canvas = FigureCanvas(self.figure)
		self.toolbar = NavigationToolbar(self.canvas, self)
		self.centralwidget = QtGui.QWidget(self)
		self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget)
		self.verticalLayout.addWidget(self.toolbar)
		self.verticalLayout.addWidget(self.canvas)
		self.centralwidget.setGeometry(10,10,825,330)

		openFile = QtGui.QAction(QtGui.QIcon('open.png'), '&Open', self)
		openFile.setShortcut('Ctrl+O')
		openFile.setStatusTip('Open new File')
		openFile.triggered.connect(self.showDialogOpen)

		chUser = QtGui.QAction('&Change Speaker', self)
		chUser.setStatusTip('Change Speaker')
		chUser.triggered.connect(self.changeUser)

		exitAction = QtGui.QAction(QtGui.QIcon('exit.png'), '&Exit', self)
		exitAction.setShortcut('Ctrl+Q')
		exitAction.setStatusTip('Exit application')
		exitAction.triggered.connect(self.closeEvent)

		utf_8 = QtGui.QAction('&UTF-8', self)
		utf_8.setStatusTip('utf-8')
		utf_8.triggered.connect(self.encodeUTF8)

		utf_16 = QtGui.QAction('&UTF-16', self)
		utf_16.setStatusTip('utf-16')
		utf_16.triggered.connect(self.encodeUTF16)

		Ascii = QtGui.QAction('&ASCII', self)
		Ascii.setStatusTip('ascii')
		Ascii.triggered.connect(self.encodeASCII)

		about = QtGui.QAction('&About', self)
		about.setStatusTip('More About Voice Recorder')
		about.triggered.connect(self.showAbout)

		self.textEdit = QtGui.QTextEdit(self)
		self.textEdit.setGeometry(10,360,825,104)
		self.textEdit.setStyleSheet("QTextEdit {font-size: 14pt}")
		self.textEdit.setText("Please Open a File...")
		self.textEdit.setReadOnly(True)

		self.Open = QtGui.QPushButton('Open', self)
		self.Open.move(10,480)
		self.Open.clicked.connect(self.showDialogOpen)

		self.Record = QtGui.QPushButton('Record', self)
		self.Record.move(155,480)
		self.Record.setEnabled(False)
		self.Record.clicked.connect(self.record)

		self.Stop = QtGui.QPushButton('Stop', self)
		self.Stop.move(300,480)
		self.Stop.setEnabled(False)
		self.Stop.clicked.connect(self.stop)

		self.Play = QtGui.QPushButton('Play', self)
		self.Play.move(445,480)
		self.Play.setEnabled(False)
		self.Play.clicked.connect(self.play)

		self.Back = QtGui.QPushButton('Back', self)
		self.Back.move(590,480)
		self.Back.setEnabled(False)
		self.Back.clicked.connect(self.showBack)

		self.Next = QtGui.QPushButton('Next', self)
		self.Next.move(735,480)
		self.Next.setEnabled(False)
		self.Next.clicked.connect(self.showNext)

		menubar = self.menuBar()
		fileMenu = menubar.addMenu('&File')
		fileMenu.addAction(openFile)
		fileMenu.addAction(chUser)
		fileMenu.addAction(exitAction)
		encodeMenu = menubar.addMenu('&Encoding')
		encodeMenu.addAction(Ascii)
		encodeMenu.addAction(utf_8)
		encodeMenu.addAction(utf_16)
		helpMenu = menubar.addMenu('&Help')
		helpMenu.addAction(about)

		self.setGeometry(200,200, 845, 550)
		self.setFixedSize(845 , 550)
		self.setWindowTitle('Akshar Voice Recorder')
		self.user = User(self)

	def showDialogOpen(self):
		plt.clf()
		self.canvas.draw()
		self.statusBar().showMessage('Open a File')
		self.fname = QtGui.QFileDialog.getOpenFileName(self, 'Open file')
		if(self.fname!=""):
			self.Record.setEnabled(True)
			self.Play.setEnabled(True)
			self.Next.setEnabled(True)
			self.Back.setEnabled(True)
			self.directory=str(self.file)+"/"+str(self.speaker)+"_"+str(self.type)+"_"+str(self.fname).split("/")[-1]
			if not os.path.exists(self.directory):
				os.makedirs(self.directory)
			del self.text[:]
			f = open(self.fname, 'r')
			for lines in f:
				self.text.append(lines)
			f.close
			if(self.decode!=""):
				self.textEdit.setText(self.text[self.line].decode(self.decode))
			else:
				self.textEdit.setText(self.text[self.line].decode('ascii'))
			self.line=0
		else:
			self.Record.setEnabled(False)
			self.Play.setEnabled(False)
			self.Next.setEnabled(False)
			self.Back.setEnabled(False)
		self.statusBar().showMessage('')

	def showNext(self):
		plt.clf()
		self.canvas.draw()
		self.line+=1
		if(len(self.text)>self.line):
			if(self.decode!=""):
				self.textEdit.setText(self.text[self.line].decode(self.decode))
			else:
				self.textEdit.setText(self.text[self.line].decode('utf-8'))
		else:
			self.showDialogOpen()

	def showBack(self):
		plt.clf()
		self.canvas.draw()
		self.line-=1
		if(len(self.text)>=self.line and self.line>=0):
			if(self.decode!=""):
				self.textEdit.setText(self.text[self.line].decode(self.decode))
			else:
				self.textEdit.setText(self.text[self.line].decode('utf-8'))
		else:
			self.showDialogOpen()

	def showAbout(self):
		self.popup1=About()
		self.popup1.exec_()

	def encodeUTF8(self):
		self.decode="utf-8"

	def encodeUTF16(self):
		self.decode="utf-16"

	def encodeASCII(self):
		self.decode="ascii"

	def changeUser(self):
		self.user.__init__(self)

	def record(self):
		plt.clf()
		self.canvas.draw()
		self.statusBar().showMessage('Recording')
		self.rec=1
		self.Record.setEnabled(False)
		self.Stop.setEnabled(True)
		self.Open.setEnabled(False)
		self.Play.setEnabled(False)
		self.Next.setEnabled(False)
		self.Back.setEnabled(False)
		self.vrThread.start()
		self.vr.record(self.directory, self.text[self.line].split(")")[0], self)

	def stop(self):
		self.statusBar().showMessage('')
		if self.rec == 1:
			self.vr.stop()
			self.vrThread.exit()
			self.vrThread.wait()
			self.vrThread.quit()
		elif self.rec == 2:
			self.pl.stop()
			self.plThread.exit()
			self.plThread.wait()
			self.plThread.quit()
		self.Record.setEnabled(True)
		self.Open.setEnabled(True)
		self.Play.setEnabled(True)
		self.Next.setEnabled(True)
		self.Back.setEnabled(True)
		self.rec=0

	def play(self):
		self.statusBar().showMessage('Playing')
		self.rec=2
		self.Record.setEnabled(False)
		self.Stop.setEnabled(True)
		self.Open.setEnabled(False)
		self.Play.setEnabled(False)
		self.Next.setEnabled(False)
		self.Back.setEnabled(False)
		self.plThread.start()
		self.pl.play(self.text[self.line].split(")")[0], self)
class Gui(QtGui.QMainWindow,QtGui.QWidget):

	def __init__(self):
		super(Gui, self).__init__()
		self.initUI()
		self.line=0
		self.text=[]
		self.decode=""

	def initUI(self):

		self.vr = VoiceRec()

		openFile = QtGui.QAction(QtGui.QIcon('open.png'), '&Open', self)
		openFile.setShortcut('Ctrl+O')
		openFile.setStatusTip('Open new File')
		openFile.triggered.connect(self.showDialogOpen)

		exitAction = QtGui.QAction(QtGui.QIcon('exit.png'), '&Exit', self)
		exitAction.setShortcut('Ctrl+Q')
		exitAction.setStatusTip('Exit application')
		exitAction.triggered.connect(QtGui.qApp.quit)

		utf_8 = QtGui.QAction('&UTF-8', self)
		utf_8.setStatusTip('utf-8')
		utf_8.triggered.connect(self.encodeUTF8)

		utf_16 = QtGui.QAction('&UTF-16', self)
		utf_16.setStatusTip('utf-16')
		utf_16.triggered.connect(self.encodeUTF16)

		about = QtGui.QAction('&About', self)
		about.setStatusTip('More About Voice Recorder')
		about.triggered.connect(self.showAbout)

		self.textEdit = QtGui.QTextEdit(self)
		self.textEdit.setGeometry(10,30,825,104)
		self.textEdit.setStyleSheet("QTextEdit {font-size: 14pt}")
		self.textEdit.setReadOnly(True)

		self.Open = QtGui.QPushButton('Open', self)
		self.Open.move(10,160)
		self.Open.clicked.connect(self.showDialogOpen)

		self.Record = QtGui.QPushButton('Record', self)
		self.Record.move(155,160)
		self.Record.clicked.connect(self.vr.record)

		self.Stop = QtGui.QPushButton('Stop', self)
		self.Stop.move(300,160)
		self.Stop.clicked.connect(self.vr.stop)

		self.Play = QtGui.QPushButton('Play', self)
		self.Play.move(445,160)
		#self.Record.clicked.connect(self.record)

		self.Back = QtGui.QPushButton('Back', self)
		self.Back.move(590,160)
		self.Back.clicked.connect(self.showBack)

		self.Next = QtGui.QPushButton('Next', self)
		self.Next.move(735,160)
		self.Next.clicked.connect(self.showNext)

		menubar = self.menuBar()
		fileMenu = menubar.addMenu('&File')
		fileMenu.addAction(openFile)
		fileMenu.addAction(exitAction)
		encodeMenu = menubar.addMenu('&Encoding')
		encodeMenu.addAction(utf_8)
		encodeMenu.addAction(utf_16)
		helpMenu = menubar.addMenu('&Help')
		helpMenu.addAction(about)

		self.setGeometry(200,200, 845, 200)
		self.setFixedSize(845 , 200)
		self.setWindowTitle('Voice Recorder')
		self.setWindowIcon(QtGui.QIcon('logo.png'))
		self.show()

	def showDialogOpen(self):
		fname = QtGui.QFileDialog.getOpenFileName(self, 'Open file','/home')
		if(fname!=""):
			del self.text[:]
			f = open(fname, 'r')
			for lines in f:
				self.text.append(lines)
			f.close
			if(self.decode!=""):
				self.textEdit.setText(self.text[self.line].decode(self.decode))
			else:
				self.textEdit.setText(self.text[self.line].decode('utf-8'))
			self.line=0

	def showNext(self):
		self.line+=1
		if(len(self.text)>self.line):
			if(self.decode!=""):
				self.textEdit.setText(self.text[self.line].decode(self.decode))
			else:
				self.textEdit.setText(self.text[self.line].decode('utf-8'))
		else:
			self.showDialogOpen()

	def showBack(self):
		self.line-=1
		if(len(self.text)>=self.line and self.line>=0):
			if(self.decode!=""):
				self.textEdit.setText(self.text[self.line].decode(self.decode))
			else:
				self.textEdit.setText(self.text[self.line].decode('utf-8'))
		else:
			self.showDialogOpen()

	def showAbout(self):
		self.popup1=About()
		self.popup1.exec_()

	def encodeUTF8(self):
		self.decode="utf-8"

	def encodeUTF16(self):
		self.decode="utf-16"
class Gui(QtGui.QMainWindow,QtGui.QWidget):

	def __init__(self):
		super(Gui, self).__init__()
		self.initUI()
		self.line=0
		self.text=[]
		self.decode=""
		self.fname="output"
		self.rec=0

	def initUI(self):
		self.setWindowIcon(QtGui.QIcon('logo.png'))
		self.vr = VoiceRec()
		self.pl = Play()
		self.spectro()
		self.vrThread = QThread()
		self.plThread = QThread()
		self.vr.moveToThread(self.vrThread)
		self.pl.moveToThread(self.plThread)

		openFile = QtGui.QAction(QtGui.QIcon('open.png'), '&Open', self)
		openFile.setShortcut('Ctrl+O')
		openFile.setStatusTip('Open new File')
		openFile.triggered.connect(self.showDialogOpen)

		exitAction = QtGui.QAction(QtGui.QIcon('exit.png'), '&Exit', self)
		exitAction.setShortcut('Ctrl+Q')
		exitAction.setStatusTip('Exit application')
		exitAction.triggered.connect(self.closeEvent)

		utf_8 = QtGui.QAction('&UTF-8', self)
		utf_8.setStatusTip('utf-8')
		utf_8.triggered.connect(self.encodeUTF8)

		utf_16 = QtGui.QAction('&UTF-16', self)
		utf_16.setStatusTip('utf-16')
		utf_16.triggered.connect(self.encodeUTF16)

		about = QtGui.QAction('&About', self)
		about.setStatusTip('More About Voice Recorder')
		about.triggered.connect(self.showAbout)

		self.textEdit = QtGui.QTextEdit(self)
		self.textEdit.setGeometry(10,30,825,104)
		self.textEdit.setStyleSheet("QTextEdit {font-size: 14pt}")
		self.textEdit.setText("Please Open a File...")
		self.textEdit.setReadOnly(True)

		self.Open = QtGui.QPushButton('Open', self)
		self.Open.move(10,160)
		self.Open.clicked.connect(self.showDialogOpen)

		self.Record = QtGui.QPushButton('Record', self)
		self.Record.move(155,160)
		self.Record.clicked.connect(self.record)

		self.Stop = QtGui.QPushButton('Stop', self)
		self.Stop.move(300,160)
		self.Stop.clicked.connect(self.stop)

		self.Play = QtGui.QPushButton('Play', self)
		self.Play.move(445,160)
		self.Play.clicked.connect(self.play)

		self.Back = QtGui.QPushButton('Back', self)
		self.Back.move(590,160)
		self.Back.clicked.connect(self.showBack)

		self.Next = QtGui.QPushButton('Next', self)
		self.Next.move(735,160)
		self.Next.clicked.connect(self.showNext)

		menubar = self.menuBar()
		fileMenu = menubar.addMenu('&File')
		fileMenu.addAction(openFile)
		fileMenu.addAction(exitAction)
		encodeMenu = menubar.addMenu('&Encoding')
		encodeMenu.addAction(utf_8)
		encodeMenu.addAction(utf_16)
		helpMenu = menubar.addMenu('&Help')
		helpMenu.addAction(about)

		self.setGeometry(200,200, 845, 550)
		self.setFixedSize(845 , 550)
		self.setWindowTitle('Voice Recorder')
		#self.setWindowIcon(QtGui.QIcon('logo.png'))
		self.show()

	def showDialogOpen(self):
		self.statusBar().showMessage('Open a File')
		self.fname = QtGui.QFileDialog.getOpenFileName(self, 'Open file','/home')
		if(self.fname!=""):
			del self.text[:]
			f = open(self.fname, 'r')
			for lines in f:
				self.text.append(lines)
			f.close
			if(self.decode!=""):
				self.textEdit.setText(self.text[self.line].decode(self.decode))
			else:
				self.textEdit.setText(self.text[self.line].decode('utf-8'))
			self.line=0
		self.statusBar().showMessage('')

	def showNext(self):
		self.line+=1
		if(len(self.text)>self.line):
			if(self.decode!=""):
				self.textEdit.setText(self.text[self.line].decode(self.decode))
			else:
				self.textEdit.setText(self.text[self.line].decode('utf-8'))
		else:
			self.showDialogOpen()

	def showBack(self):
		self.line-=1
		if(len(self.text)>=self.line and self.line>=0):
			if(self.decode!=""):
				self.textEdit.setText(self.text[self.line].decode(self.decode))
			else:
				self.textEdit.setText(self.text[self.line].decode('utf-8'))
		else:
			self.showDialogOpen()

	def showAbout(self):
		self.popup1=About()
		self.popup1.exec_()

	def encodeUTF8(self):
		self.decode="utf-8"

	def encodeUTF16(self):
		self.decode="utf-16"

	def record(self):
		self.statusBar().showMessage('Recording')
		self.rec=1
		self.Record.setEnabled(False)
		self.Open.setEnabled(False)
		self.Play.setEnabled(False)
		self.Next.setEnabled(False)
		self.Back.setEnabled(False)
		self.vrThread.start()
		self.vr.record(self.fname, self.line)

	def stop(self):
		self.statusBar().showMessage('')
		if self.rec == 1:
			self.vr.stop()
			self.vrThread.exit()
			self.vrThread.wait()
			self.vrThread.quit()
		elif self.rec == 2:
			self.pl.stop()
			self.plThread.exit()
			self.plThread.wait()
			self.plThread.quit()
		self.Record.setEnabled(True)
		self.Open.setEnabled(True)
		self.Play.setEnabled(True)
		self.Next.setEnabled(True)
		self.Back.setEnabled(True)
		self.rec=0

	def play(self):
		self.statusBar().showMessage('Playing')
		self.rec=2
		self.Record.setEnabled(False)
		self.Open.setEnabled(False)
		self.Play.setEnabled(False)
		self.Next.setEnabled(False)
		self.Back.setEnabled(False)
		self.plThread.start()
		self.pl.play(self.fname, self.line, self)

	def spectro(self):
		self.centralwidget = QtGui.QWidget(self)
		self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget)
		self.qwtPlot = Qwt.QwtPlot(self.centralwidget)
		self.verticalLayout.addWidget(self.qwtPlot)
		self.centralwidget.setGeometry(10,200,825,330)

		self.c=Qwt.QwtPlotCurve()  
		self.c.attach(self.qwtPlot)

		self.qwtPlot.setAxisScale(self.qwtPlot.yLeft, 0, 32000)

		self.timer = QTimer()
		self.timer.start(1.0)

		self.connect(self.timer, SIGNAL('timeout()'), self.plotSomething) 

		self.SR=SwhRecorder()
		self.SR.setup()
		self.SR.continuousStart()

	def plotSomething(self):
		if self.SR.newAudio==False: 
			return
		xs,ys=self.SR.fft()
		self.c.setData(xs,ys)
		self.qwtPlot.replot()
		self.SR.newAudio=False

	def closeEvent(self, event):
		self.SR.close()
		QtGui.qApp.quit()
Beispiel #50
0
class WordMobi(Application):
    
    def __init__(self):
        app.screen='normal' # TODO check all app.xyz use
        app.directional_pad = False
        LABELS.set_locale(DB["language"])
        self.wp_icon = Icon(MIFFILE,16384+14,16384+14)
        self.blogs = json.loads(DB["blog_list"])
        items = [ (b["account"],b["blog"],self.wp_icon) for b in self.blogs ]
        menu = [(LABELS.loc.wm_menu_exit, self.close_app)] 
        Application.__init__(self,  u"Wordmobi", Listbox( items, self.check_update_value ))
        self._update_menu()

        # TODO
        # {
        # Temporary fix before changing how persistence is treated.
        # New persistence module must be created to avoid this line and e32db.
        __changed = False
        for n in range(len(self.blogs)):
            if not self.blogs[n].has_key("api_key"):
                self.blogs[n]["api_key"] = ""
                __changed = True
        if __changed:
            DB["blog_list"]=json.dumps(self.blogs)
            DB.save()
        #
        # }
        #
        self.dlg = None
        sel_access_point()

        if not TOUCH_ENABLED:
            self.bind(key_codes.EKeyRightArrow, self.check_update_value)
            self.bind(key_codes.EKeyLeftArrow, self.close_app)

    def _get_menu_labels(self):
        menu_labels = [ LABELS.loc.wm_menu_sets,
                        LABELS.loc.wm_menu_upgr,
                        LABELS.loc.wm_menu_abou ]
        return menu_labels

    def _get_menu_functions(self):
        funcs = [self.settings,
                 self.upgrade,
                 self.about]
        return funcs
        
    def check_update_value(self):
        if not self.ui_is_locked():
            idx = self.body.current()
            BLOG.set_blog(idx)
            self.dlg = BlogManager(self.default_cbk,self.blogs[idx]['account'])
            self.dlg.run()
            
    def default_cbk(self):
        self.refresh()
        return True

    def _update_menu(self):
        self.global_menu = map(lambda a,b: (a,b), self._get_menu_labels(), self._get_menu_functions())
        self.global_menu += [(LABELS.loc.wm_menu_exit, self.close_app)]
            
    def settings_cbk(self):
        if self.dlg.lang_changed:
            self._update_menu()
        self.blogs = json.loads(DB["blog_list"])
        items = [ (b["account"],b["blog"],self.wp_icon) for b in self.blogs ]
        self.body.set_list(items,0)
        self.refresh()
        return True
    
    def settings(self):
        self.dlg = Settings(self.settings_cbk)
        self.dlg.run()

    def ver2num(self,ver):
        ver = ver.split("-")[0] # does not use any -RC version
        a,b,c = map(lambda x,y: x*y, [10000,100,1],[int(v) for v in ver.split(".")])
        return a+b+c
        
    def upgrade(self):
        self.lock_ui(LABELS.loc.wm_info_check_updt)
        
        url = "http://code.google.com/p/wordmobi/wiki/LatestVersion"
        local_file = "web_" + time.strftime("%Y%m%d_%H%M%S", time.localtime()) + ".html"
        local_file = os.path.join(DEFDIR, "cache", local_file)

        try:
            urlprx = UrllibProxy(BLOG.get_proxy())
            urlprx.urlretrieve(url, local_file)
        except:
            note(LABELS.loc.wm_err_upd_page % url,"error")
            ok = False
        else:
            ok = True

        if ok:
            html = open(local_file).read()
            soup = BeautifulSoup( html )
            addrs = soup.findAll('a')
            version = ""
            file_url = ""
            file_url_py19 = ""
            for addr in addrs:
                if addr.contents[0] == "latest_wordmobi_version":
                    version = addr["href"]
                elif addr.contents[0] == "wordmobi_sis_url":
                    file_url = addr["href"]
                elif addr.contents[0] == "wordmobi_sis_url_py19":
                    file_url_py19 = addr["href"]

            if version and file_url and file_url_py19:
                version = version[version.rfind("/")+1:]
                num_rem_ver = self.ver2num(version)
                num_loc_ver = self.ver2num(VERSION)
                if (num_loc_ver >= num_rem_ver) and (VERSION.find('RC') == -1):
                    # RC versions gives to the user the upgrading decision
                    note(LABELS.loc.wm_info_ver_is_updt, "info")
                else:
                    yn = popup_menu( [LABELS.loc.gm_yes,LABELS.loc.gm_no],
                                     LABELS.loc.wm_pmenu_download % (version) )
                    if yn is not None:
                        if yn == 0:
                            if float(e32.pys60_version[:3]) >= 1.9:
                                furl = file_url_py19
                            else:
                                furl = file_url
                            sis_name = furl[furl.rfind("/")+1:]
                            local_file = os.path.join(DEFDIR, "updates", sis_name)

                            self.set_title( LABELS.loc.wm_info_downloading )
                            try:
                                urlprx = UrllibProxy(BLOG.get_proxy())
                                urlprx.urlretrieve(furl, local_file)
                            except:
                                note(LABELS.loc.wm_err_downld_fail % sis_name, "error")
                            else:
                                msg = LABELS.loc.wm_info_downld_ok % (sis_name,DEFDIR)
                                note( msg , "info")

            else:
                note(LABELS.loc.wm_err_upd_info,"error")
                
        self.set_title( u"Wordmobi" )
        self.unlock_ui()
        self.refresh()

    def close_app(self):
        ny = popup_menu( [LABELS.loc.gm_yes, LABELS.loc.gm_no], LABELS.loc.wm_pmenu_exit )
        if ny is not None:
            if ny == 0:
                BLOG.save()
                self.clear_cache()
                Application.close_app(self)

    def clear_cache(self):
        not_all = False
        cache = os.path.join(DEFDIR, "cache")
        entries = os.listdir( cache )
        for e in entries:
            fname = os.path.join(cache,e)
            if os.path.isfile( fname ):
                try:
                    os.remove( fname )
                except:
                    not_all = True
        if not_all:
            note(LABELS.loc.wm_err_cache_cleanup % cache,"error")
            
    def about(self):
        self.dlg = About(self.default_cbk)
        self.dlg.run()
Beispiel #51
0
 def on_about(self):
     about = About(self)
Beispiel #52
0
 def settings(self):
     self.dlg = Settings(self.settings_cbk)
     self.dlg.run()
Beispiel #53
0
from globals import globals
from help import Help
from index import Index
from inventory import Inventory
from people import People
from presentations import Presentations
from requests_ import Requests_
from robohash import Robohash
from test import Test
from vms import VMs
from positions import Positions

app = Flask(__name__)

# The handler classes for each route type
about = About()
help = Help()
events = Events()
index = Index()
inventory = Inventory()
people = People()
requests_ = Requests_()
robohash = Robohash()
test = Test()
vms = VMs()
presentations = Presentations()
positions = Positions()

# parsed config from config.ini
config = globals.config
Beispiel #54
0
	def about(self, widget):
		about = About()
		about.show()
Beispiel #55
0
 def acercaDe(self):
     print "entra a acerca de :)"
     self.ab = About()
     self.ab.setWindowModality(Qt.ApplicationModal)
     self.ab.show()