当前位置: 首页>>代码示例>>Python>>正文


Python Misc.time_in_str_to_ms方法代码示例

本文整理汇总了Python中Misc.time_in_str_to_ms方法的典型用法代码示例。如果您正苦于以下问题:Python Misc.time_in_str_to_ms方法的具体用法?Python Misc.time_in_str_to_ms怎么用?Python Misc.time_in_str_to_ms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Misc的用法示例。


在下文中一共展示了Misc.time_in_str_to_ms方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: SelectCell

# 需要导入模块: import Misc [as 别名]
# 或者: from Misc import time_in_str_to_ms [as 别名]
    def SelectCell(self, col, row):
        """ Handle the selection of an individual cell in the Grid """
        # If we're in the "Time" column ...
        if col == 0:
            # ... determine the time of the selected item
            times = self.gridClips.GetCellValue(row, col).split('-')
            # ... and move to that time
            self.ControlObject.SetVideoStartPoint(Misc.time_in_str_to_ms(times[0]))
            # Retain the program focus in the Data Window
            self.gridClips.SetFocus()
        # If we're in the "ID" or "Keywords" column ...
        else:
            # ... if we have a Clip ...
            if self.gridClips.GetCellValue(row, 4) == 'Clip':
                # Load the Clip
                # Switched to CallAfter because of crashes on the Mac.
                wx.CallAfter(self.ControlObject.LoadClipByNumber, int(self.gridClips.GetCellValue(row, 3)))

                # NOTE:  LoadClipByNumber eliminates the DataItemsTab, so no further processing can occur!!
                #        There used to be code here to select the Clip in the Database window, but it stopped
                #        working when I added multiple transcripts, so I moved it to the ControlObject.LoadClipByNumber()
                #        method.

            # ... if we have a Snapshot ...
            elif self.gridClips.GetCellValue(row, 4) == 'Snapshot':
                tmpSnapshot = Snapshot.Snapshot(int(self.gridClips.GetCellValue(row, 3)))
                # ... load the Snapshot
                self.ControlObject.LoadSnapshot(tmpSnapshot)
                # ... determine the time of the selected item
                times = self.gridClips.GetCellValue(row, 0).split('-')
                # ... and move to that time
                self.ControlObject.SetVideoStartPoint(Misc.time_in_str_to_ms(times[0]))
                # ... and set the program focus on the Snapshot
                self.ControlObject.SelectSnapshotWindow(tmpSnapshot.id, tmpSnapshot.number, selectInDataWindow=True)
开发者ID:jdittrich,项目名称:Transana,代码行数:36,代码来源:DataItemsTab.py

示例2: get_input

# 需要导入模块: import Misc [as 别名]
# 或者: from Misc import time_in_str_to_ms [as 别名]
    def get_input(self):
        """Custom input routine."""
        # Inherit base input routine
        gen_input = Dialogs.GenForm.get_input(self)
        # If OK ...
        if gen_input:
            # Get main data values from the form, ID, Comment, and Image Filename
            self.obj.id = gen_input[_('Snapshot ID')]
            self.obj.image_filename = gen_input[_('Image Filename')]
            if gen_input[_('Episode Position')] == '':
                self.obj.episode_start = 0.0
            else:
                self.obj.episode_start = Misc.time_in_str_to_ms(gen_input[_('Episode Position')])
            if gen_input[_('Duration')] == '':
                self.obj.episode_duration = 0.0
            else:
                self.obj.episode_duration = Misc.time_in_str_to_ms(gen_input[_('Duration')])
            self.obj.comment = gen_input[_('Comment')]

        else:
            self.obj = None

        return self.obj
开发者ID:jdittrich,项目名称:Transana,代码行数:25,代码来源:SnapshotPropertiesForm.py

示例3: RunTests

# 需要导入模块: import Misc [as 别名]
# 或者: from Misc import time_in_str_to_ms [as 别名]
    def RunTests(self):
        # Tests defined:
        testsNotToSkip = []
        startAtTest = 1  # Should start at 1, not 0!
        endAtTest = 500   # Should be one more than the last test to be run!
        testsToRun = testsNotToSkip + range(startAtTest, endAtTest)

        t = datetime.datetime.now()

        if 10 in testsToRun:
            # dt_to_datestr
            testName = 'Misc.dt_to_datestr()'
            self.SetStatusText(testName)
            prompt = 'Raw Date/Time information:  %s\n\n  Is the correct M/D/Y formatted date string "%s"?' % (t, Misc.dt_to_datestr(t))
            self.ConfirmTest(prompt, testName)

        if 20 in testsToRun:
            # time_in_ms_to_str
            testName = 'Misc.time_in_ms_to_str()'
            self.SetStatusText(testName)
            prompt = 'Are the following time to string conversions correct?\n\nTime in ms:\ttime_in_ms_to_str():\n'
            for x in [100, 200, 1000, 2000, 10000, 20000, 60000, 120000, 600000, 1200000, 3600000, 7200000]:
                prompt += "  %12d\t  %s\n" % (x, Misc.time_in_ms_to_str(x))
            self.ConfirmTest(prompt, testName)

        if 30 in testsToRun:
            # TimeMsToStr
            testName = 'Misc.TimeMsToStr()'
            self.SetStatusText(testName)
            prompt = 'Are the following time to string conversions correct?\n\nTime in ms:\tTimeMsToStr():\n'
            for x in [1000, 2000, 10000, 20000, 60000, 120000, 600000, 1200000, 3600000, 7200000]:
                prompt += "  %12d\t  %s\n" % (x, Misc.TimeMsToStr(x))
            self.ConfirmTest(prompt, testName)

        if 40 in testsToRun:
            # time_in_str_to_ms
            testName = 'Misc.time_in_str_to_ms()'
            self.SetStatusText(testName)
            prompt = 'Are the following string to time conversions correct?\n\nTime in string:\ttime_in_str_to_ms():\n'
            for x in ['0:00:00.1', '0:00:00.2', '0:00:01.0', '0:00:02.0', '0:00:10.0', '0:00:20.0', '0:01:00.0', '0:02:00.0', '0:10:00.0', '0:20:00.0', '1:00:00.0', '2:00:00.0']:
                prompt += "  %s\t  %12d\n" % (x, Misc.time_in_str_to_ms(x))
            self.ConfirmTest(prompt, testName)

        if 100 in testsToRun:
            # English
            testName = 'English translation'

            langName = 'en'
            lang = wx.LANGUAGE_ENGLISH
            self.presLan_en = gettext.translation('Transana', 'locale', languages=['en']) # English
            self.presLan_en.install()
            self.locale = wx.Locale(lang)
            self.locale.AddCatalog("Transana")
            prompt  = '%s:  Series     = %s (%s)\n' % (langName, _('Series'),     type(_('Series')))
            prompt += '     Collection = %s (%s)\n' % (          _('Collection'), type(_('Collection')))
            prompt += '     Keyword    = %s (%s)\n' % (          _('Keyword'),    type(_('Keyword')))
            prompt += '     Search     = %s (%s)\n' % (          _('Search'),     type(_('Search')))
            self.ConfirmTest(prompt, testName)

        if 110 in testsToRun:
            # Arabic
            testName = 'Arabic translation'
            langName = 'ar'
            lang = wx.LANGUAGE_ARABIC
            self.presLan_ar = gettext.translation('Transana', 'locale', languages=['ar']) # Arabic
            self.presLan_ar.install()
            self.locale = wx.Locale(lang)
            prompt  = '%s:  Series     = %s (%s)\n' % (langName, _('Series'),     type(_('Series')))
            prompt += '     Collection = %s (%s)\n' % (          _('Collection'), type(_('Collection')))
            prompt += '     Keyword    = %s (%s)\n' % (          _('Keyword'),    type(_('Keyword')))
            prompt += '     Search     = %s (%s)\n' % (          _('Search'),     type(_('Search')))
            self.ConfirmTest(prompt, testName)
            
        if 120 in testsToRun:
            # Danish
            testName = 'Danish translation'
            langName = 'da'
            lang = wx.LANGUAGE_DANISH
            self.presLan_da = gettext.translation('Transana', 'locale', languages=['da']) # Danish
            self.presLan_da.install()
            self.locale = wx.Locale(lang)
            prompt  = '%s:  Series     = %s (%s)\n' % (langName, _('Series'),     type(_('Series')))
            prompt += '     Collection = %s (%s)\n' % (          _('Collection'), type(_('Collection')))
            prompt += '     Keyword    = %s (%s)\n' % (          _('Keyword'),    type(_('Keyword')))
            prompt += '     Search     = %s (%s)\n' % (          _('Search'),     type(_('Search')))
            self.ConfirmTest(prompt, testName)

        if 130 in testsToRun:
            # German
            testName = 'German translation'
            langName = 'de'
            lang = wx.LANGUAGE_GERMAN
            self.presLan_de = gettext.translation('Transana', 'locale', languages=['de']) # German
            self.presLan_de.install()
            self.locale = wx.Locale(lang)
            prompt  = '%s:  Series     = %s (%s)\n' % (langName, _('Series'),     type(_('Series')))
            prompt += '     Collection = %s (%s)\n' % (          _('Collection'), type(_('Collection')))
            prompt += '     Keyword    = %s (%s)\n' % (          _('Keyword'),    type(_('Keyword')))
            prompt += '     Search     = %s (%s)\n' % (          _('Search'),     type(_('Search')))
            self.ConfirmTest(prompt, testName)
#.........这里部分代码省略.........
开发者ID:satarsa,项目名称:Transana,代码行数:103,代码来源:unit_test_misc.py


注:本文中的Misc.time_in_str_to_ms方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。