def __createGui(self): mainSizer = wx.FlexGridSizer(cols=1) mainSizer.AddGrowableRow(0) # mainSizer.AddGrowableRow(3) mainSizer.AddGrowableCol(0) # Список с именами actions self.__actionsList = wx.ListBox(self) self.__actionsList.SetMinSize((200, -1)) # Фильтр filterSizer = wx.FlexGridSizer(cols=2) filterSizer.AddGrowableCol(1) filterLabel = wx.StaticText(self, label=_(u'Search')) self.__filterText = wx.TextCtrl(self) filterSizer.Add(filterLabel, flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=2) filterSizer.Add(self.__filterText, flag=wx.EXPAND | wx.ALL, border=2) # Sizer for hotkey and label for it hotkeySizer = wx.FlexGridSizer(cols=2) hotkeySizer.AddGrowableCol(1) # Comment to hotkeysCtrl hotkeyLabel = wx.StaticText( self, -1, _(u'Hot key.\nPress the Backspace key to clear')) # Горячая клавиша self.__hotkeyCtrl = HotkeyCtrl(self) self.__hotkeyCtrl.Disable() self.__hotkeyCtrl.SetMinSize((200, -1)) hotkeySizer.Add(hotkeyLabel, flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=2) hotkeySizer.Add(self.__hotkeyCtrl, flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.ALIGN_RIGHT, border=2) # Описание action self.__descriptionText = wx.TextCtrl( self, style=wx.TE_WORDWRAP | wx.TE_MULTILINE | wx.TE_READONLY) self.__descriptionText.SetMinSize((-1, 75)) self.__descriptionText.Disable() mainSizer.Add(self.__actionsList, flag=wx.EXPAND | wx.ALL, border=2) mainSizer.Add(self.__descriptionText, flag=wx.EXPAND | wx.ALL, border=2) mainSizer.Add(filterSizer, flag=wx.EXPAND | wx.ALL, border=2) mainSizer.Add(hotkeySizer, flag=wx.EXPAND | wx.ALL, border=2) self.SetSizer(mainSizer)
def test_key_06(self): hotkey = HotKey(u'Home', ctrl=True, shift=True, alt=True) ctrl = HotkeyCtrl(self._mainWnd) ctrl.SetValue(hotkey) self.assertEqual(ctrl.GetText(), u'Ctrl+Shift+Alt+Home') self.assertEqual(ctrl.GetValue(), hotkey)
def test_key_04(self): hotkey = HotKey(u'X', alt=True) ctrl = HotkeyCtrl(self._mainWnd) ctrl.SetValue(hotkey) self.assertEqual(ctrl.GetText(), u'Alt+X') self.assertEqual(ctrl.GetValue(), hotkey)
def test_none_02(self): ctrl = HotkeyCtrl(self._mainWnd) ctrl.SetValue(None) self.assertEqual(ctrl.GetText(), u'') self.assertEqual(ctrl.GetValue(), None)
def test_empty(self): ctrl = HotkeyCtrl(self._mainWnd) self.assertEqual(ctrl.GetText(), u'') self.assertEqual(ctrl.GetValue(), None)
def test_key_05(self): hotkey = HotKey('X', ctrl=True, shift=True, alt=True) ctrl = HotkeyCtrl(self.mainWindow) ctrl.SetValue(hotkey) self.assertEqual(ctrl.GetText(), 'Ctrl+Shift+Alt+X') self.assertEqual(ctrl.GetValue(), hotkey)
def test_key_01(self): hotkey = HotKey('X') ctrl = HotkeyCtrl(self.mainWindow) ctrl.SetValue(hotkey) self.assertEqual(ctrl.GetText(), 'X') self.assertEqual(ctrl.GetValue(), hotkey)
def test_none_01(self): ctrl = HotkeyCtrl(self.mainWindow, -1, None) self.assertEqual(ctrl.GetText(), '') self.assertEqual(ctrl.GetValue(), None)
def test_empty(self): ctrl = HotkeyCtrl(self.mainWindow) self.assertEqual(ctrl.GetText(), '') self.assertEqual(ctrl.GetValue(), None)