本文整理汇总了Python中api.configuration_api.ConfigurationAPI.get_available_printers方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigurationAPI.get_available_printers方法的具体用法?Python ConfigurationAPI.get_available_printers怎么用?Python ConfigurationAPI.get_available_printers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api.configuration_api.ConfigurationAPI
的用法示例。
在下文中一共展示了ConfigurationAPI.get_available_printers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SetupUI
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import get_available_printers [as 别名]
class SetupUI(PeachyFrame):
def initialize(self):
self._configuration_api = ConfigurationAPI(self._configuration_manager)
self.grid()
printer_selection_current = StringVar()
if not self._configuration_api.get_available_printers():
self._configuration_api.add_printer("Peachy Printer")
available_printers = self._configuration_api.get_available_printers()
printer_selection_current.set(available_printers[0])
self._printer_selected(available_printers[0])
printer_selection_menu = OptionMenu(
self,
printer_selection_current,
*available_printers,
command = self._printer_selected)
printer_selection_menu.grid(column=1,row=10,sticky=NSEW)
Button(self,text=u"Add Printer", command=self._add_printer).grid(column=2,row=10,sticky=NSEW)
Label(self).grid(column=0,row=15)
Button(self,text=u"Setup Audio", command=self._setup_audio).grid(column=1,row=20,sticky=NSEW)
Button(self,text=u"Setup Options", command=self._setup_options).grid(column=1,row=30,sticky=NSEW)
Button(self,text=u"Setup Drip Calibration", command=self._drip_calibration).grid(column=1,row=40,sticky=NSEW)
Button(self,text=u"Setup Calibration", command=self._calibration).grid(column=1,row=50,sticky=NSEW)
Button(self,text=u"Run Cure Test", command=self._cure_test).grid(column=1,row=60,sticky=NSEW)
Label(self).grid(column=0,row=70)
Button(self,text=u"Back", command=self._back).grid(column=0,row=100)
self.grid_columnconfigure(1,weight=1)
self.update()
def _printer_selected(self, selection):
self._configuration_api.load_printer(selection)
self._current_printer = selection
def _add_printer(self):
self.navigate(AddPrinterUI)
def _setup_options(self):
self.navigate(SetupOptionsUI, printer = self._current_printer)
def _drip_calibration(self):
self.navigate(DripCalibrationUI, printer = self._current_printer)
def _back(self):
self.navigate(MainUI, printer = self._current_printer)
def _setup_audio(self):
self.navigate(SetupAudioUI, printer = self._current_printer)
def _calibration(self):
self.navigate(CalibrationUI, printer = self._current_printer)
def _cure_test(self):
self.navigate(CureTestUI, printer = self._current_printer)
def close(self):
pass
示例2: PrintUI
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import get_available_printers [as 别名]
class PrintUI(PeachyFrame):
def initialize(self):
self.grid()
self.file_opt = options = {}
options['defaultextension'] = '.gcode'
options['filetypes'] = [('GCode files', '.gcode'),('all files', '.*'), ]
options['initialdir'] = '.'
options['parent'] = self
options['title'] = 'Select file to print'
self._configuration_api = ConfigurationAPI(self._configuration_manager)
self._printer_selection_current = StringVar()
if not self._configuration_api.get_available_printers():
self._configuration_api.add_printer("Peachy Printer")
available_printers = self._configuration_api.get_available_printers()
self._printer_selection_current.set(available_printers[0])
self._printer_selected(available_printers[0])
OptionMenu(self, self._printer_selection_current, *available_printers, command = self._printer_selected).grid(column=1,row=10,sticky=N+S+E+W)
Label(self).grid(column=1,row=20)
Button(self,text=u"Verify G Code", command=self.verify_g_code_click).grid(column=1,row=25,sticky=N+S+E+W)
Button(self,text=u"Print G Code", command=self.print_g_code_click).grid(column=1,row=30,sticky=N+S+E+W)
Label(self).grid(column=1,row=40)
Button(self,text=u"Back", command=self._back).grid(column=0,row=50)
self.update()
def _printer_selected(self, selection):
self._configuration_api.load_printer(selection)
def print_g_code_click(self):
filename = tkFileDialog.askopenfile(**self.file_opt)
if filename:
self.navigate(PrintStatusUI, printer =self._printer_selection_current.get(), filename = filename, config = self._configuration_api.get_current_config(), calling_class = PrintUI)
def verify_g_code_click(self):
filename = tkFileDialog.askopenfile(**self.file_opt)
if filename:
self.navigate(VerifyStatusUI, printer =self._printer_selection_current.get(), filename = filename, config = self._configuration_api.get_current_config(), calling_class = PrintUI)
def _back(self):
self.navigate(MainUI)
def close(self):
pass
示例3: test_get_available_printers_lists_printers
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import get_available_printers [as 别名]
def test_get_available_printers_lists_printers(self, mock_list):
printers = ['Tom','Dick','Harry']
capi = ConfigurationAPI(ConfigurationManager())
mock_list.return_value = printers
actual = capi.get_available_printers()
mock_list.assert_called_with()
self.assertEqual(printers,actual)