Python wx.WXK_DOWN Examples

The following are 22 code examples of wx.WXK_DOWN(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wx , or try the search function .
Example #1
Source File: CustomEditableListBox.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def OnKeyDown(self, event):
        button = None
        keycode = event.GetKeyCode()
        if keycode in (wx.WXK_ADD, wx.WXK_NUMPAD_ADD):
            button = self.GetNewButton()
        elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE):
            button = self.GetDelButton()
        elif keycode == wx.WXK_UP and event.ShiftDown():
            button = self.GetUpButton()
        elif keycode == wx.WXK_DOWN and event.ShiftDown():
            button = self.GetDownButton()
        elif keycode == wx.WXK_SPACE:
            button = self.GetEditButton()
        if button is not None and button.IsEnabled():
            button.ProcessEvent(wx.CommandEvent(wx.EVT_BUTTON.typeId, button.GetId()))
        else:
            event.Skip() 
Example #2
Source File: LibraryPanel.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def OnKeyDown(self, event):
        """
        Called when key is pressed in SearchCtrl text control
        @param event: wx.KeyEvent
        """
        # Get event keycode and value in SearchCtrl
        keycode = event.GetKeyCode()
        search_value = self.SearchCtrl.GetValue()

        # Up key was pressed and SearchCtrl isn't empty, search for block in
        # 'previous' mode
        if keycode == wx.WXK_UP and search_value != "":
            self.SearchInTree(search_value, "previous")

        # Down key was pressed and SearchCtrl isn't empty, search for block in
        # 'next' mode
        elif keycode == wx.WXK_DOWN and search_value != "":
            self.SearchInTree(search_value, "next")

        # Handle key normally
        else:
            event.Skip() 
Example #3
Source File: TextCtrlAutoComplete.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def OnKeyDown(self, event):
        """ Do some work when the user press on the keys:
            up and down: move the cursor
        """
        keycode = event.GetKeyCode()
        if keycode in [wx.WXK_DOWN, wx.WXK_UP]:
            self.PopupListBox()
            if keycode == wx.WXK_DOWN:
                self.listbox.MoveSelection(1)
            else:
                self.listbox.MoveSelection(-1)
        elif keycode in [wx.WXK_LEFT, wx.WXK_RIGHT, wx.WXK_RETURN] and self.listbox is not None:
            selected = self.listbox.GetSelection()
            if selected != "":
                self.SetValueFromSelected(selected)
            else:
                event.Skip()
        elif event.GetKeyCode() == wx.WXK_ESCAPE:
            self.DismissListBox()
        else:
            event.Skip() 
Example #4
Source File: new_properties.py    From wxGlade with MIT License 6 votes vote down vote up
def on_char_editor(self, event):
        # EVT_CHAR_HOOK handler
        keycode = event.KeyCode
        if keycode not in (wx.WXK_RETURN, wx.WXK_ESCAPE, wx.WXK_UP, wx.WXK_DOWN):
            event.Skip()
            return

        if keycode == wx.WXK_ESCAPE:
            self._update_editors()
            return

        self._on_editor_edited(event)
        if keycode==wx.WXK_UP:
            self._set_row_index( self.cur_row - 1 )
        elif keycode==wx.WXK_DOWN:
            self._set_row_index( self.cur_row + 1 )

        self._update_editors() 
Example #5
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
def onFrameCharHook(self, event):
        keyCode = event.GetKeyCode()
        if keyCode == wx.WXK_F4:
            if event.AltDown():
                self.destroyMenu()
        elif keyCode == wx.WXK_RETURN or keyCode == wx.WXK_NUMPAD_ENTER:
            self.DefaultAction()
        elif keyCode == wx.WXK_RIGHT or keyCode == wx.WXK_NUMPAD_RIGHT:
            self.DefaultAction()
        elif keyCode == wx.WXK_ESCAPE:
            self.destroyMenu()
        elif keyCode == wx.WXK_UP or keyCode == wx.WXK_NUMPAD_UP:
            self.menuGridCtrl.MoveCursor(-1)
        elif keyCode == wx.WXK_DOWN or keyCode == wx.WXK_NUMPAD_DOWN:
            self.menuGridCtrl.MoveCursor(1)
        elif keyCode == wx.WXK_LEFT or keyCode == wx.WXK_NUMPAD_LEFT:
            if len(self.oldMenu) > 0:
                self.menu, ix = self.oldMenu.pop()
                wx.CallAfter(self.UpdateMenu,ix)
            else:
                self.destroyMenu()
        else:
            event.Skip() 
Example #6
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
def onFrameCharHook(self, event):
        keyCode = event.GetKeyCode()
        if keyCode == wx.WXK_F4:
            if event.AltDown():
                self.destroyMenu()
        elif keyCode == wx.WXK_RETURN or keyCode == wx.WXK_NUMPAD_ENTER:
            self.GoTo()
        elif keyCode == wx.WXK_RIGHT or keyCode == wx.WXK_NUMPAD_RIGHT:
            self.MoveCursor(1)
        elif keyCode == wx.WXK_ESCAPE:
            self.destroyMenu()
        elif keyCode == wx.WXK_UP or keyCode == wx.WXK_NUMPAD_UP:
            self.Turn(1)
        elif keyCode == wx.WXK_DOWN or keyCode == wx.WXK_NUMPAD_DOWN:
            self.Turn(-1)
        elif keyCode == wx.WXK_LEFT or keyCode == wx.WXK_NUMPAD_LEFT:
            self.MoveCursor(-1)
        else:
            event.Skip() 
Example #7
Source File: SpinNumCtrl.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def OnChar(self, event):
        key = event.GetKeyCode()
        if key == wx.WXK_UP:
            self.OnSpinUp(event)
            return
        if key == wx.WXK_DOWN:
            self.OnSpinDown(event)
            return
        event.Skip() 
Example #8
Source File: viewer.py    From dials with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def OnKeyDown(self, event):
        key = event.GetUnicodeKey()
        if key == wx.WXK_NONE:
            key = event.GetKeyCode()
        dxs = {wx.WXK_LEFT: -1, wx.WXK_RIGHT: +1, wx.WXK_UP: 0, wx.WXK_DOWN: 0}
        dys = {wx.WXK_LEFT: 0, wx.WXK_RIGHT: 0, wx.WXK_UP: +1, wx.WXK_DOWN: -1}

        if key in dxs:
            dx = dxs[key]
            dy = dys[key]
            if event.ShiftDown():
                scale = 0.1
            else:
                scale = 1.0
            self.do_Step(dx, dy, scale) 
Example #9
Source File: geometry_viewer.py    From dials with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def OnKeyDown(self, event):
        key = event.GetUnicodeKey()
        if key == wx.WXK_NONE:
            key = event.GetKeyCode()
        dxs = {wx.WXK_LEFT: -1, wx.WXK_RIGHT: +1, wx.WXK_UP: 0, wx.WXK_DOWN: 0}
        dys = {wx.WXK_LEFT: 0, wx.WXK_RIGHT: 0, wx.WXK_UP: +1, wx.WXK_DOWN: -1}

        if key in dxs:
            dx = dxs[key]
            dy = dys[key]
            if event.ShiftDown():
                scale = 0.1
            else:
                scale = 1.0
            self.do_Step(dx, dy, scale) 
Example #10
Source File: CustomGrid.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def OnKeyDown(self, event):
        key_handled = False
        keycode = event.GetKeyCode()
        if keycode == wx.WXK_TAB:
            row = self.GetGridCursorRow()
            col = self.GetGridCursorCol()
            if event.ShiftDown():
                if row < 0 or col == 0:
                    self.Navigate(wx.NavigationKeyEvent.IsBackward)
                    key_handled = True
            elif row < 0 or col == self.Table.GetNumberCols() - 1:
                self.Navigate(wx.NavigationKeyEvent.IsForward)
                key_handled = True
        elif keycode in (wx.WXK_ADD, wx.WXK_NUMPAD_ADD) and self.Editable:
            self.AddRow()
            key_handled = True
        elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and self.Editable:
            self.DeleteRow()
            key_handled = True
        elif keycode == wx.WXK_UP and event.ShiftDown() and self.Editable:
            self.MoveRow(self.GetGridCursorRow(), -1)
            key_handled = True
        elif keycode == wx.WXK_DOWN and event.ShiftDown() and self.Editable:
            self.MoveRow(self.GetGridCursorRow(), 1)
            key_handled = True
        if not key_handled:
            event.Skip() 
Example #11
Source File: Terminal.py    From meerk40t with MIT License 5 votes vote down vote up
def on_key_down(self, event):
        key = event.GetKeyCode()
        try:
            if key == wx.WXK_DOWN:
                self.text_entry.SetValue(self.command_log[self.command_position + 1])
                wx.CallAfter(self.text_entry.SetInsertionPointEnd)
                self.command_position += 1
            elif key == wx.WXK_UP:
                self.text_entry.SetValue(self.command_log[self.command_position - 1])
                wx.CallAfter(self.text_entry.SetInsertionPointEnd)
                self.command_position -= 1
        except IndexError:
            pass
        event.Skip() 
Example #12
Source File: tree.py    From wxGlade with MIT License 5 votes vote down vote up
def on_char(self, event):
        "called from main: start label editing on F2; skip events while editing"
        keycode = event.GetKeyCode()
        if keycode==wx.WXK_F2 and self.cur_widget and self.cur_widget._label_editable():
            # start label editing
            self.EditLabel( self.cur_widget.item )
            return True
        if isinstance(self.FindFocus(), wx.TextCtrl):
            # currently editing
            event.Skip()
            return True
        if keycode in (wx.WXK_UP, wx.WXK_DOWN, wx.WXK_LEFT, wx.WXK_RIGHT):
            event.Skip()
            return True
        return False 
Example #13
Source File: main.py    From wxGlade with MIT License 5 votes vote down vote up
def on_char(self, event):
        key = (event.GetKeyCode(), event.GetModifiers())    # modifiers: 1,2,4 for Alt, Ctrl, Shift

        focused = self.FindFocus()
        if not focused or not focused.Id in self._id_to_coordinate:
            return event.Skip()

        row, col = self._id_to_coordinate[focused.Id]
        new_row = new_col = None
        if key[0]==wx.WXK_UP:
            if row>0: new_row = row-1
        elif key[0]==wx.WXK_DOWN:
            if row < len(self._ids_by_row)-1: new_row = row+1
        elif key[0]==wx.WXK_LEFT:
            if col>0: new_col = col-1
        elif key[0]==wx.WXK_RIGHT:
            if col < len(self._ids_by_row[row])-1: new_col = col+1
        elif key[0]==wx.WXK_HOME:
            new_col = 0
        elif key[0]==wx.WXK_END:
            new_col = len(self._ids_by_row[row])-1
        elif key[0]==wx.WXK_PAGEUP:
            new_row = 0
        elif key[0]==wx.WXK_PAGEDOWN:
            new_row = len(self._ids_by_row)-1
        elif (ord("A") <= key[0] <= ord("Z")) and chr(key[0]) in misc.palette_hotkeys:
            section = misc.palette_hotkeys[chr(key[0])]
            new_row = self._section_to_row[section]
            new_col = 0
        else:
            return event.Skip()

        if new_row is None and new_col is None:
            # limits hit
            wx.Bell()
        else:
            if new_col is None: new_col = min(col, len(self._ids_by_row[new_row])-1)
            if new_row is None: new_row = row
            focus = self.FindWindowById(self._ids_by_row[new_row][new_col])
            if focus: focus.SetFocus() 
Example #14
Source File: labeling_toolbox.py    From DeepLabCut with GNU Lesser General Public License v3.0 5 votes vote down vote up
def OnKeyPressed(self, event=None):
        if event.GetKeyCode() == wx.WXK_RIGHT:
            self.nextImage(event=None)
        elif event.GetKeyCode() == wx.WXK_LEFT:
            self.prevImage(event=None)
        elif event.GetKeyCode() == wx.WXK_DOWN:
            self.nextLabel(event=None)
        elif event.GetKeyCode() == wx.WXK_UP:
            self.previousLabel(event=None)
        elif event.GetKeyCode() == wx.WXK_BACK:
            pos_abs = event.GetPosition()
            inv = self.axes.transData.inverted()
            pos_rel = list(inv.transform(pos_abs))
            pos_rel[1] = (
                self.axes.get_ylim()[0] - pos_rel[1]
            )  # Recall y-axis is inverted
            i = np.nanargmin(
                [self.calc_distance(*dp.point.center, *pos_rel) for dp in self.drs]
            )
            closest_dp = self.drs[i]
            msg = wx.MessageBox(
                "Do you want to remove the label %s ?" % closest_dp.bodyParts,
                "Remove!",
                wx.YES_NO | wx.ICON_WARNING,
            )
            if msg == 2:
                closest_dp.delete_data()
                self.buttonCounter.remove(
                    self.bodyparts.index(closest_dp.bodyParts)
                ) 
Example #15
Source File: multiple_individuals_labeling_toolbox.py    From DeepLabCut with GNU Lesser General Public License v3.0 5 votes vote down vote up
def OnKeyPressed(self, event=None):
        if event.GetKeyCode() == wx.WXK_RIGHT:
            self.nextImage(event=None)
        elif event.GetKeyCode() == wx.WXK_LEFT:
            self.prevImage(event=None)
        elif event.GetKeyCode() == wx.WXK_DOWN:
            self.nextLabel(event=None)
        elif event.GetKeyCode() == wx.WXK_UP:
            self.previousLabel(event=None)
        elif event.GetKeyCode() == wx.WXK_BACK:
            pos_abs = event.GetPosition()
            inv = self.axes.transData.inverted()
            pos_rel = list(inv.transform(pos_abs))
            pos_rel[1] = (
                self.axes.get_ylim()[0] - pos_rel[1]
            )  # Recall y-axis is inverted
            i = np.nanargmin(
                [self.calc_distance(*dp.point.center, *pos_rel) for dp in self.drs]
            )
            closest_dp = self.drs[i]
            msg = wx.MessageBox(
                f"Do you want to remove the label {closest_dp.individual_names}:{closest_dp.bodyParts}?",
                "Remove!",
                wx.YES_NO | wx.ICON_WARNING,
            )
            if msg == 2:
                closest_dp.delete_data()
                self.buttonCounter[closest_dp.individual_names].remove(
                    closest_dp.bodyParts
                ) 
Example #16
Source File: backupTerminalFrontEnd.py    From HH---POS-Accounting-and-ERP-Software with MIT License 4 votes vote down vote up
def barcodeInput(self, event):
        if event.GetKeyCode() == wx.WXK_UP:
            self.suggestionList.SetSelection(self.suggestionList.GetSelection() - 1)
            return
        elif event.GetKeyCode() == wx.WXK_DOWN:
            self.suggestionList.SetSelection(self.suggestionList.GetSelection() + 1)
            return
        c = event.GetUnicodeKey()
        if c is 8:
            # backspace
            self.inputStream = self.inputStream[:-1]
        if c is 27:
            # esc key
            self.inputStream = ''
        if c in range(48, 91):
            # number or alphabet
            self.inputStream = self.inputStream + chr(c)
        if c is 13:
            # enter key
            listSelection = self.suggestionList.GetString(self.suggestionList.GetSelection())
            print(listSelection)
            if listSelection == "New Product":
                self.newProd(self.inputTC.GetValue())
                # i had to make the connection again because it wasn't fetching values (this was moved to cart.py)
                # self.t.conn = connectToDB()
                x = self.t.findProduct(self.inputTC.GetValue(), 1)
                print(x)
            else:
                x = self.t.findProduct(listSelection.split()[0], 1)
            if x == True:
                self.dumpCartInDvlc()
                self.inputStream = ''
                self.hideSearchSuggestion(None)
            '''
            else:
                x = self.t.findProduct( listSelection.split()[0] , 1 )
                print(x)
                if x == True:
                    self.dumpCartInDvlc()
                    self.inputStream = ''
                    self.hideSearchSuggestion(None)
            '''
        self.inputTC.SetValue(self.inputStream) 
Example #17
Source File: toolbar.py    From wxGlade with MIT License 4 votes vote down vote up
def on_char(self, event):
        # keyboard navigation: up/down arrows and also Tab on some buttons
        focus = self.FindFocus()
        k = event.GetKeyCode()

        if k==wx.WXK_TAB:
            if focus is self.type:
                self.label.SetFocus()
            else:
                event.Skip()
            return

        if k in (wx.WXK_DOWN, wx.WXK_UP) and focus is self.type:
            event.Skip()
            return

        if event.AltDown():
            if k==wx.WXK_RETURN or k==ord("O"):
                self.EndModal(wx.ID_OK)
                return
            if k==ord("C"):
                self.EndModal(wx.ID_CANCEL)
                return

        if event.ControlDown() and k==wx.WXK_RETURN:
            self.EndModal(wx.ID_OK)
            return

        if k==wx.WXK_RETURN:  # ignore Enter key
            return
        if k==wx.WXK_DOWN:
            if event.AltDown():
                self.move_item_down(event)
            else:
                if self.selected_index+1 < self.items.GetItemCount():
                    self._select_item(self.selected_index+1)
                else:
                    wx.Bell()
            return
        if k==wx.WXK_UP:
            if event.AltDown():
                self.move_item_up(event)
            else:
                if self.selected_index>0:
                    self._select_item(self.selected_index-1)
                else:
                    wx.Bell()
            return
        event.Skip() 
Example #18
Source File: menubar.py    From wxGlade with MIT License 4 votes vote down vote up
def on_char(self, event):
        # keyboard navigation: up/down arrows
        focus = self.FindFocus()
        k = event.GetKeyCode()
        if k==wx.WXK_TAB:
            if focus is self.type:
                self.label.SetFocus()
            else:
                event.Skip()
            return

        if k in (wx.WXK_DOWN, wx.WXK_UP) and focus is self.type:
            event.Skip()
            return

        if event.AltDown():
            if k==wx.WXK_RETURN or k==ord("O"):
                self.EndModal(wx.ID_OK)
                return
            if k==ord("C"):
                self.EndModal(wx.ID_CANCEL)
                return

        if event.ControlDown() and k==wx.WXK_RETURN:
            self.EndModal(wx.ID_OK)
            return

        if k==wx.WXK_RETURN:  # ignore Enter key
            return
        if k==wx.WXK_DOWN:
            if event.AltDown():
                self.move_item_down(event)
            else:
                if self.selected_index+1 < self.items.GetItemCount():
                    self._select_item(self.selected_index+1)
                else:
                    wx.Bell()
            return
        if k==wx.WXK_UP:
            if event.AltDown():
                self.move_item_up(event)
            else:
                if self.selected_index>0:
                    self._select_item(self.selected_index-1)
                else:
                    wx.Bell()
            return
        if k==wx.WXK_RIGHT and event.AltDown():
            self.move_item_right(event)
            return
        if k==wx.WXK_LEFT and event.AltDown():
            self.move_item_left(event)
            return
        event.Skip() 
Example #19
Source File: LDViewer.py    From OpenPLC_Editor with GNU General Public License v3.0 4 votes vote down vote up
def OnChar(self, event):
        if self.GetDrawingMode() == FREEDRAWING_MODE:
            Viewer.OnChar(self, event)
        else:
            xpos, ypos = self.GetScrollPos(wx.HORIZONTAL), self.GetScrollPos(wx.VERTICAL)
            xmax = self.GetScrollRange(wx.HORIZONTAL) - self.GetScrollThumb(wx.HORIZONTAL)
            ymax = self.GetScrollRange(wx.VERTICAL) - self.GetScrollThumb(wx.VERTICAL)
            keycode = event.GetKeyCode()
            if keycode == wx.WXK_DELETE and self.SelectedElement:
                if self.IsBlock(self.SelectedElement):
                    self.SelectedElement.Delete()
                elif self.IsWire(self.SelectedElement):
                    self.DeleteWire(self.SelectedElement)
                elif isinstance(self.SelectedElement, Graphic_Group):
                    all_wires = True
                    for element in self.SelectedElement.GetElements():
                        all_wires &= self.IsWire(element)
                    if all_wires:
                        self.DeleteWire(self.SelectedElement)
                    else:
                        self.SelectedElement.Delete()
                self.RefreshBuffer()
                self.RefreshScrollBars()
                self.Refresh(False)
            elif keycode == wx.WXK_LEFT:
                if event.ControlDown() and event.ShiftDown():
                    self.Scroll(0, ypos)
                elif event.ControlDown():
                    self.Scroll(max(0, xpos - 1), ypos)
            elif keycode == wx.WXK_RIGHT:
                if event.ControlDown() and event.ShiftDown():
                    self.Scroll(xmax, ypos)
                elif event.ControlDown():
                    self.Scroll(min(xpos + 1, xmax), ypos)
            elif keycode == wx.WXK_UP:
                if event.ControlDown() and event.ShiftDown():
                    self.Scroll(xpos, 0)
                elif event.ControlDown():
                    self.Scroll(xpos, max(0, ypos - 1))
            elif keycode == wx.WXK_DOWN:
                if event.ControlDown() and event.ShiftDown():
                    self.Scroll(xpos, ymax)
                elif event.ControlDown():
                    self.Scroll(xpos, min(ypos + 1, ymax))
            else:
                event.Skip()

    # -------------------------------------------------------------------------------
    #                  Model adding functions from Drop Target
    # ------------------------------------------------------------------------------- 
Example #20
Source File: PDFoutline.py    From PyMuPDF-Utilities with GNU General Public License v3.0 4 votes vote down vote up
def OnKeyDown(self, evt):
        if evt.ControlDown() or evt.ShiftDown(): # ignore all CTRL+ / SHIFT+
            evt.Skip()
            return
        key = evt.GetKeyCode()         # only handling UP, DOWN, ENTER
        if key not in (wx.WXK_DOWN, wx.WXK_UP, wx.WXK_RETURN):
            evt.Skip()
            return
        oldRow = self.GetGridCursorRow()
        oldCol = self.GetGridCursorCol()
        self.set_row_background(oldRow)     # ensure current row is khaki color
        maxRow = self.GetTable().GetNumberRows()

        if key == wx.WXK_UP:
            if oldRow > 0:        # only handled if not past start of grid
                self.set_row_background(oldRow - 1)
                self.MakeCellVisible(oldRow - 1, oldCol)
            evt.Skip()
            return

        if key == wx.WXK_DOWN:    # only handled if not past end of grid
            if oldRow + 1 < maxRow:
                self.set_row_background(oldRow + 1)
                self.MakeCellVisible(oldRow + 1, oldCol)
            evt.Skip()
            return

        self.DisableCellEditControl()
        success = self.MoveCursorRight(False)
        if not success:           # we are in last cell, so move to next row
            newRow = self.GetGridCursorRow() + 1
            if newRow >= maxRow:       # wrap to top if end of grid
                newRow = 0
            self.SetGridCursor(newRow, 0)
            self.MakeCellVisible(newRow, 0)
            self.set_row_background(newRow)       # recolor rows

        return

#==============================================================================
# Event Method: what to do if idling
#============================================================================== 
Example #21
Source File: terminalFrontEnd.py    From HH---POS-Accounting-and-ERP-Software with MIT License 4 votes vote down vote up
def barcodeInput (self, event):
		if event.GetKeyCode() == wx.WXK_UP:
			self.suggestionList.SetSelection( self.suggestionList.GetSelection() -1 )
			return
		elif event.GetKeyCode() == wx.WXK_DOWN:
			self.suggestionList.SetSelection( self.suggestionList.GetSelection() +1 )
			return
		c = event.GetUnicodeKey()
		if c is 8:
			# backspace
			self.inputStream = self.inputStream[:-1]
		if c is 27:
			# esc key
			self.inputStream = ''
		if c in range(48, 91):
			# number or alphabet
			self.inputStream = self.inputStream + chr(c)
		if c is 13:
			# enter key
			listSelection = self.suggestionList.GetString( self.suggestionList.GetSelection() )
			print (listSelection)
			if listSelection == "New Product":
				self.newProd( self.inputTC.GetValue() )
				# i had to make the connection again because it wasn't fetching values (this was moved to cart.py)
				#self.t.conn = connectToDB()
				x = self.t.findProduct( self.inputTC.GetValue() , 1 )
				print(x)
			else:
				x = self.t.findProduct( listSelection.split()[0] , 1 )
			if x == True:
				self.dumpCartInDvlc()
				self.inputStream = ''
				self.hideSearchSuggestion(None)
			'''
			else:
				x = self.t.findProduct( listSelection.split()[0] , 1 )
				print(x)
				if x == True:
					self.dumpCartInDvlc()
					self.inputStream = ''
					self.hideSearchSuggestion(None)
			'''
		self.inputTC.SetValue(self.inputStream) 
Example #22
Source File: terminalFrontEnd.py    From HH---POS-Accounting-and-ERP-Software with MIT License 4 votes vote down vote up
def barcodeInput (self, event):
        if event.GetKeyCode() == wx.WXK_UP:
            self.suggestionList.SetSelection( self.suggestionList.GetSelection() -1 )
            return
        elif event.GetKeyCode() == wx.WXK_DOWN:
            self.suggestionList.SetSelection( self.suggestionList.GetSelection() +1 )
            return
        c = event.GetUnicodeKey()
        if c is 8:
            # backspace
            self.inputStream = self.inputStream[:-1]
        if c is 27:
            # esc key
            self.inputStream = ''
        if c in range(48, 91):
            # number or alphabet
            self.inputStream = self.inputStream + chr(c)
        if c is 13:
            # enter key
            listSelection = self.suggestionList.GetString( self.suggestionList.GetSelection() )
            print ('print list: ' + str(listSelection))
            if listSelection == "New Product":
                self.newProd( self.inputTC.GetValue() )
                # i had to make the connection again because it wasn't fetching values (this was moved to cart.py)
                #self.t.conn = connectToDB()
                x = self.t.findProduct( self.inputTC.GetValue() , 1 )
                print('print x: ' + str(x))
            else:
                x = self.t.findProduct( listSelection.split()[0] , 1 )
            if x == True:
                self.dumpCartInDvlc()
                self.inputStream = ''
                self.hideSearchSuggestion(None)
            '''
            else:
                x = self.t.findProduct( listSelection.split()[0] , 1 )
                print(x)
                if x == True:
                    self.dumpCartInDvlc()
                    self.inputStream = ''
                    self.hideSearchSuggestion(None)
            '''

        print('print inoutstream:' + str(self.inputStream))
        self.inputTC.SetValue(self.inputStream)