Пример #1
0
        def __SetContent(self, filename):
            lang = glo.Settings['lang']
            self.SetTitle(glo.GetText('vcutter_frame_title', lang))
            for element in self.panel.GetChildren():
                name = element.GetName()
                text = glo.GetText(name, lang)
                variable = glo.GetText(name, 'var')
                varstr = ''
                if variable != 'n/a':
                    varstr = glo.Get(variable)
                if text != 'n/a':
                    element.SetLabel(text + varstr)

            self.qualityRadioBox.SetItemLabel(
                0, glo.GetText('vcutter_dialog_quality_box_0', lang))
            self.qualityRadioBox.SetItemLabel(
                1, glo.GetText('vcutter_dialog_quality_box_1', lang))

            if filename is not None:
                self.ap.Open(filename)
                self.regions = None

                self.__SetQuality()

                self.canvasPanel.set_lines_content(
                    self.scaleFunc(self.volumeSlider.GetValue()),
                    self.lCutSlider.GetValue() / self.MAX_VAL,
                    1.0 - self.rCutSlider.GetValue() / self.MAX_VAL)
Пример #2
0
 def __SaveQuestion(self):
     lang = glo.Settings['lang']
     if self.fileChanged and not self.fileSaved:
         if wx.MessageBox(glo.GetText('save_dialog_question_text', lang),
                          glo.GetText('save_dialog_question_title', lang),
                          wx.ICON_QUESTION | wx.YES_NO) == wx.YES:
             return True
         return False
     return True
Пример #3
0
 def __SetContent(self):
     lang = glo.Settings['lang']
     self.SetTitle(glo.GetText('about_frame_title', lang))
     for element in self.panel.GetChildren():
         name = element.GetName()
         text = glo.GetText(name, lang)
         variable = glo.GetText(name, 'var')
         varstr = ''
         if variable != 'n/a':
             varstr = glo.Get(variable)
         if text != 'n/a':
             element.SetLabel(text + varstr)
Пример #4
0
 def __SetMenuBarContent(self, lang):
     menus = []
     for menu in self.menus:
         menus.append((menu[0], glo.GetText(menu[1], lang)))
     for menuItem in self.menuItems:
         if 'name' in menuItem:
             name = menuItem['name']
             text = glo.GetText(name, lang)
             obj = menuItem['object']
             obj.SetItemLabel(text[0])
             obj.SetHelp(text[1])
     self.menuBar.SetMenus(menus)
Пример #5
0
 def __DelegateOpeningFile(self, pathname):
     #opening error handle
     try:
         if platform.system() == 'Darwin':
             subprocess.call(('open', pathname))
         elif platform.system() == 'Windows':
             os.startfile(os.path.normpath(pathname))
         else:
             subprocess.call(('xdg-open', pathname))
     except:
         lang = glo.Settings['lang']
         wx.MessageDialog(
             self,
             message=glo.GetText('file_open_error_dialog_text', lang),
             caption=glo.GetText('file_open_error_dialog_title', lang),
             style=wx.OK | wx.CENTRE | wx.ICON_WARNING).ShowModal()
Пример #6
0
 def __SetWidgetsContent(self, lang):
     self.__SetDevicesList(self.panel.FindWindow('input_device_choice'))
     for element in self.panel.GetChildren():
         name = element.GetName()
         text = glo.GetText(name, lang)
         if text != 'n/a':
             element.SetLabel(text)
Пример #7
0
 def __SetContent(self):
     self.SetIcon(self.icon)
     lang = glo.Settings['lang']
     self.SetTitle(glo.GetText('main_frame_title', lang))
     self.__SetWidgetsContent(lang)
     self.__SetMenuBarContent(lang)
     self.__SetStatusBarContent(lang)
Пример #8
0
 def __Open(self, event):
     if not self.__SaveQuestion():
         return
     self.__SetState(self.STATE_RESET)
     lang = glo.Settings['lang']
     with wx.FileDialog(
             self,
             glo.GetText('file_open_dialog_title', lang),
             wildcard=glo.GetText('file_open_dialog_wildcard', lang) +
             '(*.*)|*.*',
             style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) as fileDialog:
         if fileDialog.ShowModal() == wx.ID_CANCEL:
             return
         pathname = fileDialog.GetPath()
         self.panel.FindWindow('session_name_text_control').SetValue(
             self.__process_path(pathname))
         self.__DelegateOpeningFile(pathname)
Пример #9
0
        def __SetContent(self):
            lang = glo.Settings['lang']
            self.SetTitle(glo.GetText('regexp_frame_title', lang))

            cb = self.panel.FindWindow('regexp_dialog_checkbox')
            cb.SetValue(glo.Settings['pathname_regexp'][0])
            tc = self.panel.FindWindow('regexp_dialog_text_control')
            tc.SetValue(glo.Settings['pathname_regexp'][1])
            tc.Enable(cb.IsChecked())
            sc = self.panel.FindWindow('regexp_dialog_spin_control')
            sc.SetValue(glo.Settings['pathname_regexp'][2])
            sc.Enable(cb.IsChecked())

            for element in self.panel.GetChildren():
                name = element.GetName()
                text = glo.GetText(name, lang)
                variable = glo.GetText(name, 'var')
                varstr = ''
                if variable != 'n/a':
                    varstr = glo.Get(variable)
                if text != 'n/a':
                    element.SetLabel(text + varstr)
Пример #10
0
 def __SaveDialog(self):
     lang = glo.Settings['lang']
     sessionName = self.panel.FindWindow(
         'session_name_text_control').GetValue()
     if sessionName == '':
         sessionName = glo.GetText('default_session_name', lang)
     with wx.FileDialog(self,
                        glo.GetText('save_dialog_title', lang),
                        wildcard=glo.GetText('save_dialog_wildcard', lang) +
                        ' (*.wav)|*.wav',
                        defaultFile=sessionName + '.wav',
                        style=wx.FD_SAVE
                        | wx.FD_OVERWRITE_PROMPT) as fileDialog:
         if fileDialog.ShowModal() == wx.ID_CANCEL:
             return False
         try:
             copy(self.recorder.get_filename(), fileDialog.GetPath())
             return True
         except:
             wx.MessageBox(glo.GetText('save_dialog_error_text', lang),
                           glo.GetText('save_dialog_error_title', lang),
                           wx.ICON_ERROR | wx.OK)
             return False
Пример #11
0
 def __SetStatusBarContent(self, lang):
     self.statusBar.SetStatusText(
         glo.GetText(self.statusTexts[self.state], lang))