コード例 #1
0
	def _check_out(self):
		"""
		Allows the user to check out items.
		"""
		logger.debug("Enter")
		
		item_lists = [self.common_tools, self.uncommon_tools, self.common_keys, self.uncommon_keys]
		item_set = Shelf()
			
		for item in item_lists:
			item_set.extend(item.items_out()) # Update latest checked out items.
				
		item_set.update_names()
		item_set_names = self.tools.trim_items(item_set.items_out_by_name())
			
		# Make sure we have some items checked out.
		if not item_set_names:
			self._create_dialog_msg(False, "Please either hit 'Cancel' or select some items to check out.")
			return
			
		item_set.remove_clicks()
		
		for item in item_set_names:
			if 'laptop' in item or 'lrduo' in item:
				self._create_dialog_acknowledge() # Should display only if a fluke or laptop is in the items list
				break

		self.tools.checkout_items(self.current_user, item_set_names, self._get_building_number())
		self.inventory.update(item_set_names)
		
		self._switch_frame('login')
		
		logger.debug("Exit")
コード例 #2
0
    def _check_out(self):
        """
		Allows the user to check out items.
		"""
        logger.debug("Enter")

        item_lists = [
            self.common_tools, self.uncommon_tools, self.common_keys,
            self.uncommon_keys
        ]
        item_set = Shelf()

        for item in item_lists:
            item_set.extend(
                item.items_out())  # Update latest checked out items.

        item_set.update_names()
        item_set_names = self.tools.trim_items(item_set.items_out_by_name())

        # Make sure we have some items checked out.
        if not item_set_names:
            self._create_dialog_msg(
                False,
                "Please either hit 'Cancel' or select some items to check out."
            )
            return

        item_set.remove_clicks()

        for item in item_set_names:
            if 'laptop' in item or 'lrduo' in item:
                self._create_dialog_acknowledge(
                )  # Should display only if a fluke or laptop is in the items list
                break

        self.tools.checkout_items(self.current_user, item_set_names,
                                  self._get_building_number())
        self.inventory.update(item_set_names)

        self._switch_frame('login')

        logger.debug("Exit")
コード例 #3
0
    def _create_dialog_items_out(self):
        """
		Creates a dialog for displaying who has what checked out.
		"""
        logger.debug("Enter")

        window = self._setup_dialog(w=700, h=550)

        frame_holder = []

        if self.tools.transactions != {}:
            for user in self.tools.transactions.keys():
                Label(window,
                      text='%s - %s' %
                      (user.capitalize(),
                       self.tools.get_building_by_user(user))).pack()

                tmp = Frame(window)
                tmp.pack()

                items = self.tools.transactions[user][-1]

                shelf_tmp = Shelf(tmp, items)
                shelf_tmp.remove_clicks()

                self._grid_buttons(shelf_tmp)

        else:
            Label(window, text="No items are currently out.").pack()

        button_ok = Button(window, text="Ok", command=window.destroy)
        button_ok.bind("<Return>", lambda e: window.destroy())
        button_ok.bind("<KP_Enter>", lambda e: window.destroy())
        button_ok.focus_set()
        button_ok.pack()

        window.wait_window(window)

        logger.debug("Exit")
コード例 #4
0
	def _create_dialog_items_out(self):
		"""
		Creates a dialog for displaying who has what checked out.
		"""
		logger.debug("Enter")
		
		window = self._setup_dialog(w = 700, h = 550)
		
		frame_holder = []
		
		if self.tools.transactions != {}:
			for user in self.tools.transactions.keys():
				Label(window, text = '%s - %s' % (user.capitalize(), self.tools.get_building_by_user(user))).pack()
			
				tmp = Frame(window)
				tmp.pack()

				items = self.tools.transactions[user][-1]
				
				shelf_tmp = Shelf(tmp, items)
				shelf_tmp.remove_clicks()
				
				self._grid_buttons(shelf_tmp)
				
		else:
			Label(window, text = "No items are currently out.").pack()
			
		button_ok = Button(window, text = "Ok", command = window.destroy)
		button_ok.bind("<Return>", lambda e: window.destroy())
		button_ok.bind("<KP_Enter>", lambda e: window.destroy())
		button_ok.focus_set()
		button_ok.pack()
		
		window.wait_window(window)
		
		logger.debug("Exit")