3131 QApplication ,
3232 QCheckBox ,
3333 QComboBox ,
34- QColorDialog ,
3534 QDialog ,
3635 QDialogButtonBox ,
3736 QDoubleSpinBox ,
7978 from OpenNumismat .Tools .DialogDecorators import storeDlgSizeDecorator , storeDlgPositionDecorator
8079 from OpenNumismat .Tools .Gui import getSaveFileName , Splitter , ColorButton
8180 from OpenNumismat .Tools .misc import readImageFilters , saveImageFilters
81+ from OpenNumismat .Tools .dependencies import HAS_REMBG
8282 from OpenNumismat import version
8383
8484 PORTABLE = version .Portable
9191 HOME_PATH = '.'
9292 IMAGE_PATH = QStandardPaths .standardLocations (QStandardPaths .PicturesLocation )[0 ]
9393 PORTABLE = True
94+ HAS_REMBG = True
9495
9596ZOOM_LIST = (600 , 480 , 385 , 310 , 250 , 200 , 158 , 125 ,
9697 100 , 80 , 64 , 50 , 40 , 32 , 26 , 20 , 16 ,)
@@ -1261,7 +1262,8 @@ def createActions(self):
12611262 self .nextImageAct = QAction (QIcon (':/arrow_right.png' ), self .tr ("Next image" ), self , shortcut = QKeySequence .MoveToNextWord , triggered = self .nextImage )
12621263 self .prevRecordAct = QAction (QIcon (':/arrow_up.png' ), self .tr ("Previous record" ), self , shortcut = Qt .CTRL | Qt .Key_Up , triggered = self .prevRecord )
12631264 self .nextRecordAct = QAction (QIcon (':/arrow_down.png' ), self .tr ("Next record" ), self , shortcut = Qt .CTRL | Qt .Key_Down , triggered = self .nextRecord )
1264- self .rembgAct = QAction (self .tr ("Remove background" ), self , triggered = self .rembg )
1265+ if HAS_REMBG :
1266+ self .rembgAct = QAction (self .tr ("Remove background" ), self , triggered = self .rembg )
12651267
12661268 settings = QSettings ()
12671269 toolBarShown = settings .value ('image_viewer/tool_bar' , True , type = bool )
@@ -1301,7 +1303,8 @@ def createMenus(self):
13011303 self .editMenu .addAction (self .rotateAct )
13021304 self .editMenu .addAction (self .cropAct )
13031305 self .editMenu .addAction (self .autocropAct )
1304- self .editMenu .addAction (self .rembgAct )
1306+ if HAS_REMBG :
1307+ self .editMenu .addAction (self .rembgAct )
13051308 self .editMenu .addSeparator ()
13061309 if self .use_webcam :
13071310 self .editMenu .addAction (self .cameraAct )
@@ -2070,7 +2073,8 @@ def _updateActions(self):
20702073 self .rotateAct .setEnabled (enabled and not self .readonly )
20712074 self .cropAct .setEnabled (enabled and not self .readonly )
20722075 self .autocropAct .setEnabled (enabled and not self .readonly )
2073- self .rembgAct .setEnabled (enabled and not self .readonly )
2076+ if HAS_REMBG :
2077+ self .rembgAct .setEnabled (enabled and not self .readonly )
20742078 self .cutLeftAct .setEnabled (enabled and not self .readonly )
20752079 self .cutRightAct .setEnabled (enabled and not self .readonly )
20762080 if self .use_webcam :
@@ -2089,7 +2093,8 @@ def _updateEditActions(self):
20892093 self .rotateAct .setDisabled (inCrop )
20902094 self .cropAct .setDisabled (inRotate )
20912095 self .autocropAct .setDisabled (inCrop or inRotate )
2092- self .rembgAct .setDisabled (inCrop or inRotate )
2096+ if HAS_REMBG :
2097+ self .rembgAct .setDisabled (inCrop or inRotate )
20932098 self .cutLeftAct .setDisabled (inCrop or inRotate )
20942099 self .cutRightAct .setDisabled (inCrop or inRotate )
20952100 if self .use_webcam :
0 commit comments