Beispiel #1
0
 /**
  * @param $config SliceConfig
  * @return Form
  */
 public function _createSliceConfigUploadForm($config)
 {
     $form = new Form('upload');
     //load up our engines.
     if (User::isAdmin()) {
         $engines = SliceEngine::getAllEngines()->getAll();
     } else {
         $engines = SliceEngine::getPublicEngines()->getAll();
     }
     $engs = array();
     foreach ($engines as $row) {
         /* @var $e SliceEngine */
         $e = $row['SliceEngine'];
         $engs[$e->id] = $e->getName();
     }
     $form->add(SelectField::name('engine_id')->label('Slice Engine')->help('Which slicing engine does this config use?')->required(true)->value($config->get('engine_id'))->options($engs));
     $form->add(TextField::name('config_name')->label('Config Name')->help('What is the name of this slicing configuration.')->required(true)->value($config->get('config_name')));
     if ($config->isHydrated()) {
         $form->add(CheckboxField::name('expire_slicejobs')->label('Expire Old Slice Jobs')->help('If checked, old slice jobs will be expired and never re-used.')->value(1));
     }
     $form->add(UploadField::name('config_file')->label('Configuration File')->help('The configuration file to use (.ini for Slic3r)')->required(true));
     return $form;
 }
Beispiel #2
0
 /**
  * @param $bot Bot is the selected bot
  * @return form Form the form we return
  */
 private function _createSlicingForm($bot)
 {
     //load up our engines.
     if (User::isAdmin()) {
         $allEngines = SliceEngine::getAllEngines()->getAll();
     } else {
         $allEngines = SliceEngine::getPublicEngines()->getAll();
     }
     $engineList[0] = "None";
     foreach ($allEngines as $row) {
         /* @var $e SliceEngine */
         $e = $row['SliceEngine'];
         $engineList[$e->id] = $e->getName();
     }
     //load up our configs
     $engine = $bot->getSliceEngine();
     $myConfigs = $engine->getMyConfigs()->getAll();
     $configList = array();
     if (!empty($myConfigs)) {
         foreach ($myConfigs as $row) {
             /* @var $c SliceConfig */
             $c = $row['SliceConfig'];
             $configList[$c->id] = $c->getName();
         }
     } else {
         $configList[0] = "None";
     }
     $form = new Form('slicing');
     if ($this->args('setup')) {
         $form->action = $bot->getUrl() . "/edit/setup";
     } else {
         $form->action = $bot->getUrl() . "/edit";
     }
     $form->add(DisplayField::name('title')->label('')->value('<h2>Slicing Setup</h2>'));
     $config = $bot->getDriverConfig();
     $form->add(CheckboxField::name('can_slice')->label('Client Slicing Enabled?')->help('Is the controlling computer fast enough to slice?')->value($config->can_slice));
     $form->add(SelectField::name('slice_engine_id')->id('slice_engine_dropdown')->label('Slice Engine')->help('Which slicing engine does this bot use?')->value($bot->get('slice_engine_id'))->options($engineList)->onchange('update_slice_config_dropdown(this)'));
     $form->add(SelectField::name('slice_config_id')->id('slice_config_dropdown')->label('Slice Configuration')->help('Which slicing configuration to use? <a href="/slicers">click here</a> to view/edit configs.')->value($bot->get('slice_config_id'))->options($configList));
     return $form;
 }